proj_name stringclasses 131
values | relative_path stringlengths 30 228 | class_name stringlengths 1 68 | func_name stringlengths 1 48 | masked_class stringlengths 78 9.82k | func_body stringlengths 46 9.61k | len_input int64 29 2.01k | len_output int64 14 1.94k | total int64 55 2.05k | relevant_context stringlengths 0 38.4k |
|---|---|---|---|---|---|---|---|---|---|
crate_crate | crate/server/src/main/java/io/crate/execution/TransportExecutorModule.java | TransportExecutorModule | configure | class TransportExecutorModule extends AbstractModule {
@Override
protected void configure() {<FILL_FUNCTION_BODY>}
} |
bind(JobSetup.class).asEagerSingleton();
bind(LuceneQueryBuilder.class).asEagerSingleton();
bind(TransportCreateTableAction.class).asEagerSingleton();
bind(TransportRenameTableAction.class).asEagerSingleton();
bind(TransportSwapAndDropIndexNameAction.class).asEagerSingleton();
... | 35 | 398 | 433 | <methods>public non-sealed void <init>() ,public final synchronized void configure(org.elasticsearch.common.inject.Binder) <variables>org.elasticsearch.common.inject.Binder binder |
crate_crate | crate/server/src/main/java/io/crate/execution/ddl/AbstractDDLTransportAction.java | AbstractDDLTransportAction | masterOperation | class AbstractDDLTransportAction<Request extends AcknowledgedRequest<Request>, Response extends AcknowledgedResponse> extends TransportMasterNodeAction<Request, Response> {
private final Writeable.Reader<Response> reader;
private final Function<Boolean, Response> ackedResponseFunction;
private final String... |
clusterService.submitStateUpdateTask(source,
request,
ClusterStateTaskConfig.build(Priority.HIGH, request.masterNodeTimeout()),
clusterStateTaskExecutor(request),
new AckedClusterStateTaskListener() {
@Override
public void onFailur... | 348 | 221 | 569 | <methods><variables>protected final non-sealed org.elasticsearch.cluster.service.ClusterService clusterService,private final non-sealed java.lang.String executor,protected final non-sealed org.elasticsearch.threadpool.ThreadPool threadPool,protected final non-sealed org.elasticsearch.transport.TransportService transpor... |
crate_crate | crate/server/src/main/java/io/crate/execution/ddl/TransportSwapRelationsAction.java | TransportSwapRelationsAction | checkBlock | class TransportSwapRelationsAction extends TransportMasterNodeAction<SwapRelationsRequest, AcknowledgedResponse> {
private final SwapRelationsOperation swapRelationsOperation;
private final ActiveShardsObserver activeShardsObserver;
@Inject
public TransportSwapRelationsAction(Settings settings,
... |
Set<String> affectedIndices = new HashSet<>();
Metadata metadata = state.metadata();
for (RelationNameSwap swapAction : request.swapActions()) {
affectedIndices.addAll(Arrays.asList(IndexNameExpressionResolver.concreteIndexNames(
metadata, IndicesOptions.LENIENT_EXPA... | 761 | 274 | 1,035 | <methods><variables>protected final non-sealed org.elasticsearch.cluster.service.ClusterService clusterService,private final non-sealed java.lang.String executor,protected final non-sealed org.elasticsearch.threadpool.ThreadPool threadPool,protected final non-sealed org.elasticsearch.transport.TransportService transpor... |
crate_crate | crate/server/src/main/java/io/crate/execution/ddl/tables/AddColumnRequest.java | AddColumnRequest | writeTo | class AddColumnRequest extends AcknowledgedRequest<AddColumnRequest> {
private final RelationName relationName;
private final List<Reference> colsToAdd;
private final IntArrayList pKeyIndices;
private final Map<String, String> checkConstraints;
/**
* @param checkConstraints must be accumulate... |
super.writeTo(out);
relationName.writeTo(out);
out.writeMap(checkConstraints, StreamOutput::writeString, StreamOutput::writeString);
out.writeCollection(colsToAdd, Reference::toStream);
out.writeVInt(pKeyIndices.size());
for (int i = 0; i < pKeyIndices.size(); i++) {
... | 533 | 119 | 652 | <methods>public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public io.crate.common.unit.TimeValue ackTimeout() ,public final io.crate.execution.ddl.tables.AddColumnRequest timeout(java.lang.String) ,public final io.crate.execution.ddl.tables.AddColumnRequest timeout(io.crate.c... |
crate_crate | crate/server/src/main/java/io/crate/execution/ddl/tables/CreateTableRequest.java | CreateTableRequest | writeTo | class CreateTableRequest extends MasterNodeRequest<CreateTableRequest> implements AckedRequest {
// Fields required to add column(s), aligned with AddColumnRequest
private final RelationName relationName;
private final List<Reference> colsToAdd;
@Nullable
private final String pkConstraintName;
... |
super.writeTo(out);
if (out.getVersion().onOrAfter(Version.V_5_6_0)) {
out.writeOptionalString(pkConstraintName);
}
if (out.getVersion().onOrAfter(Version.V_5_4_0)) {
relationName.writeTo(out);
out.writeMap(checkConstraints, StreamOutput::writeString,... | 1,520 | 298 | 1,818 | <methods>public final io.crate.execution.ddl.tables.CreateTableRequest masterNodeTimeout(io.crate.common.unit.TimeValue) ,public final io.crate.execution.ddl.tables.CreateTableRequest masterNodeTimeout(java.lang.String) ,public final io.crate.common.unit.TimeValue masterNodeTimeout() ,public void writeTo(org.elasticsea... |
crate_crate | crate/server/src/main/java/io/crate/execution/ddl/tables/TransportCreateTableAction.java | TransportCreateTableAction | masterOperation | class TransportCreateTableAction extends TransportMasterNodeAction<CreateTableRequest, CreateTableResponse> {
public static final String NAME = "internal:crate:sql/tables/admin/create";
private final MetadataCreateIndexService createIndexService;
private final MetadataIndexTemplateService indexTemplateSer... |
final RelationName relationName = createTableRequest.getTableName();
if (state.metadata().contains(relationName)) {
listener.onFailure(new RelationAlreadyExists(relationName));
return;
}
validateSettings(createTableRequest.settings(), state);
if (state.... | 1,660 | 350 | 2,010 | <methods><variables>protected final non-sealed org.elasticsearch.cluster.service.ClusterService clusterService,private final non-sealed java.lang.String executor,protected final non-sealed org.elasticsearch.threadpool.ThreadPool threadPool,protected final non-sealed org.elasticsearch.transport.TransportService transpor... |
crate_crate | crate/server/src/main/java/io/crate/execution/ddl/tables/TransportDropConstraintAction.java | TransportDropConstraintAction | clusterStateTaskExecutor | class TransportDropConstraintAction extends AbstractDDLTransportAction<DropConstraintRequest, AcknowledgedResponse> {
private static final String ACTION_NAME = "internal:crate:sql/table/drop_constraint";
private final NodeContext nodeContext;
private final IndicesService indicesService;
@Inject
pu... |
return new DDLClusterStateTaskExecutor<>() {
@Override
protected ClusterState execute(ClusterState currentState, DropConstraintRequest request) throws Exception {
Metadata.Builder metadataBuilder = Metadata.builder(currentState.metadata());
boolean update... | 577 | 399 | 976 | <methods>public void <init>(java.lang.String, org.elasticsearch.transport.TransportService, org.elasticsearch.cluster.service.ClusterService, org.elasticsearch.threadpool.ThreadPool, Reader<io.crate.execution.ddl.tables.DropConstraintRequest>, Reader<org.elasticsearch.action.support.master.AcknowledgedResponse>, Functi... |
crate_crate | crate/server/src/main/java/io/crate/execution/ddl/tables/TransportRenameTableAction.java | TransportRenameTableAction | masterOperation | class TransportRenameTableAction extends TransportMasterNodeAction<RenameTableRequest, AcknowledgedResponse> {
private static final String ACTION_NAME = "internal:crate:sql/table/rename";
private static final IndicesOptions STRICT_INDICES_OPTIONS = IndicesOptions.fromOptions(false, false, false, false);
p... |
AtomicReference<String[]> newIndexNames = new AtomicReference<>(null);
ActionListener<AcknowledgedResponse> waitForShardsListener = ActionListeners.waitForShards(
listener,
activeShardsObserver,
request.timeout(),
() -> logger.info("Renamed a relation, bu... | 581 | 331 | 912 | <methods><variables>protected final non-sealed org.elasticsearch.cluster.service.ClusterService clusterService,private final non-sealed java.lang.String executor,protected final non-sealed org.elasticsearch.threadpool.ThreadPool threadPool,protected final non-sealed org.elasticsearch.transport.TransportService transpor... |
crate_crate | crate/server/src/main/java/io/crate/execution/ddl/views/TransportCreateViewAction.java | TransportCreateViewAction | masterOperation | class TransportCreateViewAction extends TransportMasterNodeAction<CreateViewRequest, CreateViewResponse> {
@Inject
public TransportCreateViewAction(TransportService transportService,
ClusterService clusterService,
ThreadPool threadPool) ... |
if (!request.replaceExisting() && state.metadata().contains(request.name())) {
listener.onResponse(new CreateViewResponse(true));
} else {
clusterService.submitStateUpdateTask("views/create [" + request.name() + "]",
new AckedClusterStateUpdateTask<CreateViewRes... | 266 | 351 | 617 | <methods><variables>protected final non-sealed org.elasticsearch.cluster.service.ClusterService clusterService,private final non-sealed java.lang.String executor,protected final non-sealed org.elasticsearch.threadpool.ThreadPool threadPool,protected final non-sealed org.elasticsearch.transport.TransportService transpor... |
crate_crate | crate/server/src/main/java/io/crate/execution/ddl/views/TransportDropViewAction.java | TransportDropViewAction | masterOperation | class TransportDropViewAction extends TransportMasterNodeAction<DropViewRequest, DropViewResponse> {
private final DDLClusterStateService ddlClusterStateService;
@Inject
public TransportDropViewAction(TransportService transportService,
ClusterService clusterService,
... |
clusterService.submitStateUpdateTask("views/drop",
new AckedClusterStateUpdateTask<DropViewResponse>(Priority.HIGH, request, listener) {
private List<RelationName> missing;
@Override
public ClusterState execute(ClusterState currentState) {
... | 311 | 320 | 631 | <methods><variables>protected final non-sealed org.elasticsearch.cluster.service.ClusterService clusterService,private final non-sealed java.lang.String executor,protected final non-sealed org.elasticsearch.threadpool.ThreadPool threadPool,protected final non-sealed org.elasticsearch.transport.TransportService transpor... |
crate_crate | crate/server/src/main/java/io/crate/execution/dml/BitStringIndexer.java | BitStringIndexer | indexValue | class BitStringIndexer implements ValueIndexer<BitString> {
private final Reference ref;
private final FieldType fieldType;
private final String name;
public BitStringIndexer(Reference ref, FieldType fieldType) {
this.ref = ref;
this.name = ref.storageIdent();
this.fieldType = ... |
BitSet bitSet = value.bitSet();
byte[] bytes = bitSet.toByteArray();
xcontentBuilder.value(bytes);
BytesRef binaryValue = new BytesRef(bytes);
if (ref.indexType() != IndexType.NONE) {
addField.accept(new Field(name, binaryValue, fieldType));
}
if (r... | 195 | 170 | 365 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/dml/FloatIndexer.java | FloatIndexer | indexValue | class FloatIndexer implements ValueIndexer<Float> {
private final Reference ref;
private final FieldType fieldType;
private String name;
public FloatIndexer(Reference ref, FieldType fieldType) {
this.ref = ref;
this.name = ref.storageIdent();
this.fieldType = fieldType;
}
... |
xcontentBuilder.value(value);
float floatValue = value.floatValue();
if (ref.hasDocValues() && ref.indexType() != IndexType.NONE) {
addField.accept(new FloatField(name, floatValue, fieldType.stored() ? Field.Store.YES : Field.Store.NO));
} else {
if (ref.indexTyp... | 171 | 256 | 427 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/dml/FloatVectorIndexer.java | FloatVectorIndexer | indexValue | class FloatVectorIndexer implements ValueIndexer<float[]> {
final FieldType fieldType;
private final String name;
private final Reference ref;
public FloatVectorIndexer(Reference ref, @Nullable FieldType fieldType) {
if (fieldType == null) {
fieldType = new FieldType(FloatVectorFie... |
if (values == null) {
return;
}
xcontentBuilder.startArray();
for (float value : values) {
xcontentBuilder.value(value);
}
xcontentBuilder.endArray();
createFields(
name,
fieldType,
ref.indexType() != I... | 534 | 141 | 675 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/dml/FulltextIndexer.java | FulltextIndexer | indexValue | class FulltextIndexer implements ValueIndexer<String> {
private final Reference ref;
private final FieldType fieldType;
public FulltextIndexer(Reference ref, FieldType fieldType) {
this.ref = ref;
this.fieldType = fieldType;
}
@Override
public void indexValue(String value,
... |
xcontentBuilder.value(value);
if (value == null) {
return;
}
String name = ref.storageIdent();
if (fieldType.indexOptions() != IndexOptions.NONE || fieldType.stored()) {
Field field = new Field(name, value, fieldType);
addField.accept(field);
... | 160 | 145 | 305 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/dml/ShardRequest.java | ShardRequest | toString | class ShardRequest<T extends ShardRequest<T, I>, I extends ShardRequest.Item>
extends ReplicationRequest<T>
implements Iterable<I>, Accountable {
private static final long SHALLOW_SIZE = RamUsageEstimator.shallowSizeOfInstance(ShardRequest.class);
private final UUID jobId;
protected List<I> items;... |
return "ShardRequest{" +
", shardId=" + shardId +
", timeout=" + timeout +
'}';
| 1,398 | 39 | 1,437 | <methods>public void <init>() ,public void <init>(org.elasticsearch.index.shard.ShardId) ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public java.lang.String getDescription() ,public java.lang.String index() ,public final T index(java.lang.String) ,public java.lang.Stri... |
crate_crate | crate/server/src/main/java/io/crate/execution/dml/delete/ShardDeleteRequest.java | ShardDeleteRequest | writeTo | class ShardDeleteRequest extends ShardRequest<ShardDeleteRequest, ShardDeleteRequest.Item> {
private int skipFromLocation = -1;
public ShardDeleteRequest(ShardId shardId, UUID jobId) {
super(shardId, jobId);
}
void skipFromLocation(int location) {
skipFromLocation = location;
}
... |
super.writeTo(out);
out.writeVInt(items.size());
for (Item item : items) {
item.writeTo(out);
}
if (skipFromLocation > -1) {
out.writeBoolean(true);
out.writeVInt(skipFromLocation);
} else {
out.writeBoolean(false);
... | 356 | 96 | 452 | <methods>public void <init>(org.elasticsearch.index.shard.ShardId, java.util.UUID) ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public void add(int, io.crate.execution.dml.delete.ShardDeleteRequest.Item) ,public boolean equals(java.lang.Object) ,public int hashCode() ,p... |
crate_crate | crate/server/src/main/java/io/crate/execution/dsl/phases/CountPhase.java | CountPhase | equals | class CountPhase implements UpstreamPhase {
private final int executionPhaseId;
private final Routing routing;
private final Symbol where;
private DistributionInfo distributionInfo;
public CountPhase(int executionPhaseId,
Routing routing,
Symbol where,
... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
CountPhase that = (CountPhase) o;
return executionPhaseId == that.executionPhaseId &&
Objects.equals(routing, that.routing) &&
... | 552 | 121 | 673 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/dsl/phases/ExecutionPhases.java | ExecutionPhases | debugPrint | class ExecutionPhases {
/**
* @return true if the executionNodes indicate a execution on the handler node.
*
* size == 0 is also true
* (this currently is the case on MergePhases if there is a direct-response from previous phase to MergePhase)
*/
public static boolean executesOnHandler... |
StringBuilder sb = new StringBuilder("phase{id=");
sb.append(phase.phaseId());
sb.append("/");
sb.append(phase.name());
sb.append(", ");
sb.append("nodes=");
sb.append(phase.nodeIds());
if (phase instanceof UpstreamPhase) {
UpstreamPhase uPhas... | 354 | 148 | 502 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/dsl/phases/FetchPhase.java | FetchPhase | equals | class FetchPhase implements ExecutionPhase {
private final TreeMap<String, Integer> bases;
private final Map<RelationName, Collection<String>> tableIndices;
private final Collection<Reference> fetchRefs;
private final int executionPhaseId;
private final Set<String> executionNodes;
public Fetc... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
FetchPhase that = (FetchPhase) o;
return executionPhaseId == that.executionPhaseId &&
Objects.equals(bases, that.bases) &&
... | 1,181 | 145 | 1,326 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/dsl/phases/NodeOperationTree.java | NodeOperationTree | toString | class NodeOperationTree {
private final Collection<NodeOperation> nodeOperations;
private final ExecutionPhase leaf;
public NodeOperationTree(Collection<NodeOperation> nodeOperations, ExecutionPhase leaf) {
this.nodeOperations = nodeOperations;
this.leaf = leaf;
}
/**
* all N... |
return "NodeOperationTree{" +
"nodeOperations=" + nodeOperations +
", leaf=" + leaf +
'}';
| 187 | 39 | 226 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/dsl/phases/PKLookupPhase.java | PKLookupPhase | writeTo | class PKLookupPhase extends AbstractProjectionsPhase implements CollectPhase {
private final List<ColumnIdent> partitionedByColumns;
private final List<Symbol> toCollect;
private final Map<String, Map<ShardId, List<PKAndVersion>>> idsByShardByNode;
private DistributionInfo distInfo = DistributionInfo.D... |
super.writeTo(out);
distInfo.writeTo(out);
Symbols.toStream(toCollect, out);
out.writeVInt(idsByShardByNode.size());
for (Map.Entry<String, Map<ShardId, List<PKAndVersion>>> byNodeEntry : idsByShardByNode.entrySet()) {
Map<ShardId, List<PKAndVersion>> idsByShard = b... | 1,080 | 301 | 1,381 | <methods>public void addProjection(io.crate.execution.dsl.projection.Projection) ,public boolean equals(java.lang.Object) ,public Optional<io.crate.execution.dsl.projection.Projection> finalProjection() ,public boolean hasProjections() ,public int hashCode() ,public java.util.UUID jobId() ,public java.lang.String name(... |
crate_crate | crate/server/src/main/java/io/crate/execution/dsl/projection/FetchProjection.java | FetchProjection | generateStreamersGroupedByReaderAndNode | class FetchProjection extends Projection {
private static final int HEAP_IN_MB = (int) (JvmInfo.jvmInfo().getConfiguredMaxHeapSize() / (1024 * 1024));
private static final int MAX_FETCH_SIZE = maxFetchSize(HEAP_IN_MB);
private final int fetchPhaseId;
private final int fetchSize;
private final Map<... |
HashMap<String, IntObjectHashMap<Streamer<?>[]>> streamersByReaderByNode = new HashMap<>();
for (Map.Entry<String, IntSet> entry : nodeReaders.entrySet()) {
IntObjectHashMap<Streamer<?>[]> streamersByReaderId = new IntObjectHashMap<>();
String nodeId = entry.getKey();
... | 1,493 | 255 | 1,748 | <methods>public non-sealed void <init>() ,public abstract R accept(ProjectionVisitor<C,R>, C) ,public abstract boolean equals(java.lang.Object) ,public static io.crate.execution.dsl.projection.Projection fromStream(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public int hashCode() ,public ... |
crate_crate | crate/server/src/main/java/io/crate/execution/dsl/projection/GroupProjection.java | GroupProjection | equals | class GroupProjection extends Projection {
private final List<Symbol> keys;
private final List<Aggregation> values;
private List<Symbol> outputs;
private final AggregateMode mode;
private final RowGranularity requiredGranularity;
public GroupProjection(List<Symbol> keys,
... |
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
GroupProjection that = (GroupProjection) o;
return Objects.equals(keys, that.keys) &&
Objects.equals(values, that.values) &&
... | 919 | 130 | 1,049 | <methods>public non-sealed void <init>() ,public abstract R accept(ProjectionVisitor<C,R>, C) ,public abstract boolean equals(java.lang.Object) ,public static io.crate.execution.dsl.projection.Projection fromStream(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public int hashCode() ,public ... |
crate_crate | crate/server/src/main/java/io/crate/execution/dsl/projection/LimitAndOffsetProjection.java | LimitAndOffsetProjection | equals | class LimitAndOffsetProjection extends Projection {
private final int limit;
private final int offset;
private final List<Symbol> outputs;
public LimitAndOffsetProjection(int limit, int offset, List<DataType<?>> outputTypes) {
this.limit = limit;
this.offset = offset;
this.outp... |
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
LimitAndOffsetProjection that = (LimitAndOffsetProjection) o;
if (limit != that.limit) return false;
if (offset != that.offset) return false;
if (!outputs.equals(that.outputs)) retur... | 586 | 106 | 692 | <methods>public non-sealed void <init>() ,public abstract R accept(ProjectionVisitor<C,R>, C) ,public abstract boolean equals(java.lang.Object) ,public static io.crate.execution.dsl.projection.Projection fromStream(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public int hashCode() ,public ... |
crate_crate | crate/server/src/main/java/io/crate/execution/dsl/projection/SysUpdateProjection.java | SysUpdateProjection | writeTo | class SysUpdateProjection extends Projection {
private final Symbol uidSymbol;
private Map<Reference, Symbol> assignments;
private Symbol[] outputs;
@Nullable
private Symbol[] returnValues;
public SysUpdateProjection(Symbol uidSymbol,
Map<Reference, Symbol> as... |
Symbols.toStream(uidSymbol, out);
out.writeVInt(assignments.size());
for (Map.Entry<Reference, Symbol> e : assignments.entrySet()) {
Reference.toStream(out, e.getKey());
Symbols.toStream(e.getValue(), out);
}
if (out.getVersion().onOrAfter(Version.V_4_2_... | 978 | 238 | 1,216 | <methods>public non-sealed void <init>() ,public abstract R accept(ProjectionVisitor<C,R>, C) ,public abstract boolean equals(java.lang.Object) ,public static io.crate.execution.dsl.projection.Projection fromStream(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public int hashCode() ,public ... |
crate_crate | crate/server/src/main/java/io/crate/execution/dsl/projection/UpdateProjection.java | UpdateProjection | equals | class UpdateProjection extends Projection {
final Symbol uidSymbol;
private Symbol[] assignments;
// All values of this list are expected to be a FQN columnIdent.
private String[] assignmentsColumns;
private Symbol[] outputs;
@Nullable
private Symbol[] returnValues;
@Nullable
pr... |
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
UpdateProjection that = (UpdateProjection) o;
if (!Arrays.equals(assignments, that.assignments)) return false;
if (!Arrays.equals(assignmentsColumns, that.assignmentsColumns)) return false;
... | 1,414 | 191 | 1,605 | <methods>public non-sealed void <init>() ,public abstract R accept(ProjectionVisitor<C,R>, C) ,public abstract boolean equals(java.lang.Object) ,public static io.crate.execution.dsl.projection.Projection fromStream(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public int hashCode() ,public ... |
crate_crate | crate/server/src/main/java/io/crate/execution/dsl/projection/builder/SplitPointsBuilder.java | Context | create | class Context {
private final ArrayList<Function> aggregates = new ArrayList<>();
private final ArrayList<Function> tableFunctions = new ArrayList<>();
private final ArrayList<Symbol> standalone = new ArrayList<>();
private final ArrayList<WindowFunction> windowFunctions = new ArrayList<... |
Context context = new Context();
INSTANCE.process(relation.outputs(), context);
OrderBy orderBy = relation.orderBy();
if (orderBy != null) {
INSTANCE.process(orderBy.orderBySymbols(), context);
}
Symbol having = relation.having();
if (having != null) ... | 518 | 890 | 1,408 | <methods>public non-sealed void <init>() ,public java.lang.Void visitAlias(io.crate.expression.symbol.AliasSymbol, io.crate.execution.dsl.projection.builder.SplitPointsBuilder.Context) ,public java.lang.Void visitFetchReference(io.crate.expression.symbol.FetchReference, io.crate.execution.dsl.projection.builder.SplitPo... |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/PagingUnsupportedResultListener.java | PagingUnsupportedResultListener | needMore | class PagingUnsupportedResultListener implements PageResultListener {
static final PagingUnsupportedResultListener INSTANCE = new PagingUnsupportedResultListener();
private PagingUnsupportedResultListener() {
}
@Override
public void needMore(boolean needMore) {<FILL_FUNCTION_BODY>}
} |
if (needMore) {
throw new IllegalStateException(
"A downstream requested more data from an upstream, but that is not supported in direct-response mode");
}
| 82 | 47 | 129 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/aggregation/impl/Aggregations.java | Aggregations | addFunctions | class Aggregations implements FunctionsProvider {
@Override
public void addFunctions(Settings settings,
SessionSettingRegistry sessionSettingRegistry,
Builder builder) {<FILL_FUNCTION_BODY>}
} |
AverageAggregation.register(builder);
NumericAverageAggregation.register(builder);
IntervalAverageAggregation.register(builder);
MinimumAggregation.register(builder);
MaximumAggregation.register(builder);
ArbitraryAggregation.register(builder);
CmpByAggregation.r... | 55 | 214 | 269 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/aggregation/impl/MaximumAggregation.java | FixedMaximumAggregation | reduce | class FixedMaximumAggregation extends MaximumAggregation {
private final int size;
public FixedMaximumAggregation(Signature signature, BoundSignature boundSignature) {
super(signature, boundSignature);
size = ((FixedWidthType) partialType()).fixedSize();
}
@Nul... |
if (state1 == null) {
return state2;
}
if (state2 == null) {
return state1;
}
int cmp = type.compare(state1, state2);
if (cmp < 0) {
return state2;
}
return state1;
| 432 | 82 | 514 | <methods>public non-sealed void <init>() ,public DocValueAggregator<?> getDocValueAggregator(io.crate.expression.reference.doc.lucene.LuceneReferenceResolver, List<io.crate.metadata.Reference>, io.crate.metadata.doc.DocTableInfo, List<Literal<?>>) ,public boolean isRemovableCumulative() ,public transient abstract java.... |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/aggregation/impl/StandardDeviationAggregation.java | StdDevStateType | iterate | class StdDevStateType extends DataType<StandardDeviation> implements Streamer<StandardDeviation>, FixedWidthType {
public static final StdDevStateType INSTANCE = new StdDevStateType();
public static final int ID = 8192;
@Override
public int id() {
return ID;
}
... |
if (state != null) {
Number value = (Number) args[0].value();
if (value != null) {
state.increment(value.doubleValue());
}
}
return state;
| 609 | 60 | 669 | <methods>public non-sealed void <init>() ,public DocValueAggregator<?> getDocValueAggregator(io.crate.expression.reference.doc.lucene.LuceneReferenceResolver, List<io.crate.metadata.Reference>, io.crate.metadata.doc.DocTableInfo, List<Literal<?>>) ,public boolean isRemovableCumulative() ,public transient abstract io.cr... |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/aggregation/impl/StringAgg.java | StringAggStateType | removeFromAggregatedState | class StringAggStateType extends DataType<StringAggState> implements Streamer<StringAggState> {
static final StringAggStateType INSTANCE = new StringAggStateType();
@Override
public int id() {
return 1025;
}
@Override
public Precedence precedence() {
... |
String expression = (String) stateToRemove[0].value();
if (expression == null) {
return previousAggState;
}
String delimiter = (String) stateToRemove[1].value();
int indexOfExpression = previousAggState.values.indexOf(expression);
if (indexOfExpression > -1)... | 793 | 215 | 1,008 | <methods>public non-sealed void <init>() ,public DocValueAggregator<?> getDocValueAggregator(io.crate.expression.reference.doc.lucene.LuceneReferenceResolver, List<io.crate.metadata.Reference>, io.crate.metadata.doc.DocTableInfo, List<Literal<?>>) ,public boolean isRemovableCumulative() ,public transient abstract io.cr... |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/aggregation/impl/TDigestState.java | TDigestState | read | class TDigestState extends AVLTreeDigest {
public static final long SHALLOW_SIZE = RamUsageEstimator.shallowSizeOfInstance(TDigestState.class);
private static final int DEFAULT_COMPRESSION = 100;
private final double compression;
private double[] fractions;
TDigestState(double compression, double... |
double compression = in.readDouble();
double[] fractions = in.readDoubleArray();
TDigestState state = new TDigestState(compression, fractions);
int n = in.readVInt();
for (int i = 0; i < n; i++) {
state.add(in.readDouble(), in.readVInt());
}
return st... | 382 | 99 | 481 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/aggregation/impl/average/AverageAggregation.java | AverageState | compareTo | class AverageState implements Comparable<AverageState> {
private double sum = 0;
private long count = 0;
private final KahanSummationForDouble kahanSummationForDouble = new KahanSummationForDouble();
public Double value() {
if (count > 0) {
return sum / coun... |
if (o == null) {
return 1;
} else {
int compare = Double.compare(sum, o.sum);
if (compare == 0) {
return Long.compare(count, o.count);
}
return compare;
}
| 469 | 71 | 540 | <methods>public non-sealed void <init>() ,public DocValueAggregator<?> getDocValueAggregator(io.crate.expression.reference.doc.lucene.LuceneReferenceResolver, List<io.crate.metadata.Reference>, io.crate.metadata.doc.DocTableInfo, List<Literal<?>>) ,public boolean isRemovableCumulative() ,public transient abstract io.cr... |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/aggregation/impl/average/numeric/NumericAverageStateType.java | NumericAverageStateType | writeValueTo | class NumericAverageStateType extends DataType<NumericAverageState> implements Streamer<NumericAverageState> {
public static final int ID = 1026;
public static final long INIT_SIZE = NumericType.size(BigDecimal.ZERO) + 8; // Nominator and primitive long denominator.
public static final NumericAverageStateT... |
// We want to preserve the scale and precision
// from the numeric argument type for the return type.
out.writeInt(v.sum.value().precision());
out.writeInt(v.sum.value().scale());
NumericType.INSTANCE.writeValueTo(out, v.sum.value()); // NumericType.INSTANCE writes unscaled valu... | 518 | 106 | 624 | <methods>public non-sealed void <init>() ,public void addMappingOptions(Map<java.lang.String,java.lang.Object>) ,public java.lang.Integer characterMaximumLength() ,public ColumnStatsSupport<NumericAverageState#RAW> columnStatsSupport() ,public int compareTo(DataType<?>) ,public boolean equals(java.lang.Object) ,public ... |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/aggregation/impl/templates/SortedNumericDocValueAggregator.java | SortedNumericDocValueAggregator | apply | class SortedNumericDocValueAggregator<T> implements DocValueAggregator<T> {
private final String columnName;
private final TriFunction<RamAccounting, MemoryManager, Version, T> stateInitializer;
private final CheckedBiConsumer<SortedNumericDocValues, T, IOException> docValuesConsumer;
private SortedNu... |
if (values.advanceExact(doc) && values.docValueCount() == 1) {
docValuesConsumer.accept(values, state);
}
| 363 | 42 | 405 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/aggregation/statistics/Variance.java | Variance | merge | class Variance implements Writeable, Comparable<Variance> {
private double sumOfSqrs;
private double sum;
private long count;
public Variance() {
sumOfSqrs = 0.0;
sum = 0.0;
count = 0;
}
public Variance(StreamInput in) throws IOException {
sumOfSqrs = in.readDo... |
sumOfSqrs += other.sumOfSqrs;
sum += other.sum;
count += other.count;
| 484 | 35 | 519 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/collect/BlobShardCollectorProvider.java | BlobShardCollectorProvider | getOrderedCollector | class BlobShardCollectorProvider extends ShardCollectorProvider {
private final BlobShard blobShard;
private final InputFactory inputFactory;
public BlobShardCollectorProvider(BlobShard blobShard,
ClusterService clusterService,
Sc... |
RoutedCollectPhase normalizedCollectPhase = collectPhase.normalize(shardNormalizer, collectTask.txnCtx());
return new BlobOrderedDocCollector(
blobShard.indexShard().shardId(),
getBlobRows(collectTask.txnCtx(), normalizedCollectPhase, requiresRepeat));
| 594 | 87 | 681 | <methods>public CompletableFuture<io.crate.execution.engine.collect.ShardCollectorProvider.BatchIteratorFactory> awaitShardSearchActive() ,public io.crate.execution.engine.pipeline.ProjectorFactory getProjectorFactory() ,public io.crate.expression.reference.sys.shard.ShardRowContext shardRowContext() <variables>private... |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/collect/PKLookupOperation.java | PKLookupOperation | lookup | class PKLookupOperation {
private final IndicesService indicesService;
private final ShardCollectSource shardCollectSource;
public PKLookupOperation(IndicesService indicesService, ShardCollectSource shardCollectSource) {
this.indicesService = indicesService;
this.shardCollectSource = shard... |
ArrayList<BatchIterator<Row>> iterators = new ArrayList<>(idsByShard.size());
for (Map.Entry<ShardId, List<PKAndVersion>> idsByShardEntry : idsByShard.entrySet()) {
ShardId shardId = idsByShardEntry.getKey();
IndexService indexService = indicesService.indexService(shardId.getInd... | 632 | 655 | 1,287 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/collect/RemoteCollectorFactory.java | RemoteCollectorFactory | createCollector | class RemoteCollectorFactory {
private static final Logger LOGGER = LogManager.getLogger(RemoteCollectorFactory.class);
private static final int SENDER_PHASE_ID = 0;
private final ClusterService clusterService;
private final TasksService tasksService;
private final ElasticsearchClient elasticsearc... |
ShardStateObserver shardStateObserver = new ShardStateObserver(clusterService);
return shardStateObserver.waitForActiveShard(shardId).thenCompose(primaryRouting -> localOrRemoteCollect(
primaryRouting,
collectPhase,
collectTask,
shardCollectorProviderFact... | 1,247 | 89 | 1,336 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/collect/RowCollectExpression.java | RowCollectExpression | setNextRow | class RowCollectExpression implements CollectExpression<Row, Object> {
private final int index;
private Object value;
public RowCollectExpression(int index) {
this.index = index;
}
@Override
public void setNextRow(Row row) {<FILL_FUNCTION_BODY>}
@Override
public Object value(... |
assert row.numColumns() > index
: "Wanted to retrieve value for column at position=" + index + " from row=" + row + " but row has only " + row.numColumns() + " columns";
value = row.get(index);
| 302 | 65 | 367 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/collect/RowShardResolver.java | RowShardResolver | setNextRow | class RowShardResolver {
private final Function<List<String>, String> idFunction;
private final List<Input<?>> primaryKeyInputs;
private final Input<?> routingInput;
private final Iterable<CollectExpression<Row, ?>> expressions;
private String id;
private String routing;
private List<Strin... |
for (CollectExpression<Row, ?> expression : expressions) {
expression.setNextRow(row);
}
if (setAutoGeneratedTimestamp) {
autoGeneratedTimestamp = Math.max(0, System.currentTimeMillis());
}
pkValues = pkValues(primaryKeyInputs);
id = idFunction.ap... | 587 | 185 | 772 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/collect/RowsTransformer.java | RowsTransformer | toRowsIterable | class RowsTransformer {
public static Iterable<Row> toRowsIterable(TransactionContext txnCtx,
InputFactory inputFactory,
ReferenceResolver<?> referenceResolver,
RoutedCollect... |
if (!WhereClause.canMatch(collectPhase.where())) {
return Collections.emptyList();
}
InputFactory.Context ctx = inputFactory.ctxForRefs(txnCtx, referenceResolver);
ctx.add(collectPhase.toCollect());
OrderBy orderBy = collectPhase.orderBy();
if (orderBy != nul... | 312 | 399 | 711 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/collect/ValueAndInputRow.java | ValueAndInputRow | apply | class ValueAndInputRow<TValue> extends InputRow implements Function<TValue, Row>, Supplier<TValue> {
private final Iterable<? extends CollectExpression<TValue, ?>> expressions;
private TValue value;
public ValueAndInputRow(List<? extends Input<?>> inputs, Iterable<? extends CollectExpression<TValue, ?>> e... |
value = input;
for (CollectExpression<TValue, ?> expression : expressions) {
expression.setNextRow(input);
}
return this;
| 166 | 44 | 210 | <methods>public void <init>(List<? extends Input<?>>) ,public java.lang.Object get(int) ,public int numColumns() ,public java.lang.String toString() <variables>private final non-sealed List<? extends Input<?>> inputs |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/collect/collectors/LuceneBatchIterator.java | LuceneBatchIterator | moveNext | class LuceneBatchIterator implements BatchIterator<Row> {
private final IndexSearcher indexSearcher;
private final Query query;
private final CollectorContext collectorContext;
private final boolean doScores;
private final LuceneCollectorExpression[] expressions;
private final List<LeafReaderCo... |
raiseIfKilled();
if (weight == null) {
try {
weight = createWeight();
} catch (IOException e) {
Exceptions.rethrowUnchecked(e);
}
}
try {
return innerMoveNext();
} catch (IOException e) {
... | 1,279 | 91 | 1,370 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/collect/collectors/OrderedDocCollector.java | OrderedDocCollector | empty | class OrderedDocCollector implements Supplier<KeyIterable<ShardId, Row>>, AutoCloseable, Killable {
private final ShardId shardId;
protected final KeyIterable<ShardId, Row> empty;
boolean exhausted = false;
public static OrderedDocCollector empty(ShardId shardId) {<FILL_FUNCTION_BODY>}
OrderedDo... |
return new OrderedDocCollector(shardId) {
@Override
protected KeyIterable<ShardId, Row> collect() {
return empty;
}
@Override
public boolean exhausted() {
return true;
}
};
| 437 | 70 | 507 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/collect/collectors/OrderedLuceneBatchIteratorFactory.java | Factory | toMapByShardId | class Factory {
private final List<OrderedDocCollector> orderedDocCollectors;
private final Executor executor;
private final IntSupplier availableThreads;
private final PagingIterator<ShardId, Row> pagingIterator;
private final Map<ShardId, OrderedDocCollector> collectorsByShard... |
Map<ShardId, OrderedDocCollector> collectorsByShardId = new HashMap<>(collectors.size());
for (OrderedDocCollector collector : collectors) {
collectorsByShardId.put(collector.shardId(), collector);
}
return collectorsByShardId;
| 904 | 82 | 986 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/collect/collectors/RemoteCollector.java | RemoteCollector | createLocalContext | class RemoteCollector {
private static final Logger LOGGER = LogManager.getLogger(RemoteCollector.class);
private static final int RECEIVER_PHASE_ID = 1;
private final UUID jobId;
private final SessionSettings sessionSettings;
private final String localNode;
private final String remoteNode;
... |
RootTask.Builder builder = createPageDownstreamContext();
try {
synchronized (killLock) {
if (collectorKilled) {
consumer.accept(null, new InterruptedException());
return false;
}
context = tasksService.... | 1,388 | 142 | 1,530 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/collect/collectors/ScoreDocRowFunction.java | ScoreDocRowFunction | apply | class ScoreDocRowFunction implements Function<ScoreDoc, Row> {
private final List<OrderByCollectorExpression> orderByCollectorExpressions = new ArrayList<>();
private final IndexReader indexReader;
private final LuceneCollectorExpression[] expressions;
private final DummyScorer scorer;
private fina... |
onScoreDoc.run();
if (input == null) {
return null;
}
FieldDoc fieldDoc = (FieldDoc) input;
scorer.score(fieldDoc.score);
for (int i = 0; i < orderByCollectorExpressions.size(); i++) {
orderByCollectorExpressions.get(i).setNextFieldDoc(fieldDoc);
... | 433 | 263 | 696 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/collect/collectors/ShardStateObserver.java | ShardStateObserver | shardStartedOrIndexDeleted | class ShardStateObserver {
private static final TimeValue MAX_WAIT_TIME_FOR_NEW_STATE = TimeValue.timeValueSeconds(30);
private static final Logger LOGGER = LogManager.getLogger(ShardStateObserver.class);
private final ClusterService clusterService;
public ShardStateObserver(ClusterService clusterSer... |
try {
return state.routingTable().shardRoutingTable(shardId).primaryShard().started();
} catch (ShardNotFoundException e) {
return false;
} catch (IndexNotFoundException e) {
return true;
}
| 742 | 69 | 811 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/collect/files/CopyModule.java | CopyModule | configure | class CopyModule extends AbstractModule {
List<CopyPlugin> copyPlugins;
public CopyModule(List<CopyPlugin> copyPlugins) {
this.copyPlugins = copyPlugins;
}
@Override
protected void configure() {<FILL_FUNCTION_BODY>}
} |
MapBinder<String, FileInputFactory> fileInputFactoryMapBinder = MapBinder.newMapBinder(binder(), String.class, FileInputFactory.class);
MapBinder<String, FileOutputFactory> fileOutputFactoryMapBinder = MapBinder.newMapBinder(binder(), String.class, FileOutputFactory.class);
fileInputFactoryMap... | 82 | 274 | 356 | <methods>public non-sealed void <init>() ,public final synchronized void configure(org.elasticsearch.common.inject.Binder) <variables>org.elasticsearch.common.inject.Binder binder |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/collect/files/FileReadingIterator.java | LineCursor | equals | class LineCursor {
private URI uri;
private long lineNumber;
private String line;
private IOException failure;
public LineCursor() {
}
public LineCursor(URI uri, long lineNumber, @Nullable String line, @Nullable IOException failure) {
this.uri = uri;... |
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
return false;
}
LineCursor other = (LineCursor) obj;
return Objects.eq... | 326 | 126 | 452 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/collect/files/SummitsIterable.java | SummitsIterable | fetchSummits | class SummitsIterable implements Iterable<SummitsContext> {
private final Supplier<List<SummitsContext>> summitsSupplierCache = Suppliers.memoizeWithExpiration(
this::fetchSummits, 4, TimeUnit.MINUTES
);
private List<SummitsContext> fetchSummits() {<FILL_FUNCTION_BODY>}
private static Integer... |
List<SummitsContext> summits = new ArrayList<>();
try (InputStream input = SummitsIterable.class.getResourceAsStream("/config/names.txt")) {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(input, StandardCharsets.UTF_8))) {
String line;
... | 272 | 259 | 531 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/collect/files/URLFileInput.java | URLFileInput | expandUri | class URLFileInput implements FileInput {
private final URI fileUri;
public URLFileInput(URI fileUri) {
// If the full fileUri contains a wildcard the fileUri passed as argument here is the fileUri up to the wildcard
this.fileUri = fileUri;
}
@Override
public boolean isGlobbed() {... |
// for URLs listing directory contents is not supported so always return the full fileUri for now
return Collections.singletonList(this.fileUri);
| 210 | 39 | 249 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/collect/sources/FileCollectSource.java | FileCollectSource | targetUriToStringList | class FileCollectSource implements CollectSource {
private final ClusterService clusterService;
private final Map<String, FileInputFactory> fileInputFactoryMap;
private final InputFactory inputFactory;
private final NodeContext nodeCtx;
private final ThreadPool threadPool;
private final Roles r... |
Object value = SymbolEvaluator.evaluate(txnCtx, nodeCtx, targetUri, Row.EMPTY, SubQueryResults.EMPTY);
if (targetUri.valueType().id() == DataTypes.STRING.id()) {
String uri = (String) value;
return Collections.singletonList(uri);
} else if (DataTypes.STRING_ARRAY.equals(... | 870 | 165 | 1,035 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/collect/sources/TableFunctionCollectSource.java | TableFunctionCollectSource | getIterator | class TableFunctionCollectSource implements CollectSource {
private final NodeContext nodeCtx;
private final InputFactory inputFactory;
@Inject
public TableFunctionCollectSource(NodeContext nodeCtx) {
this.nodeCtx = nodeCtx;
inputFactory = new InputFactory(nodeCtx);
}
@Overrid... |
TableFunctionCollectPhase phase = (TableFunctionCollectPhase) collectPhase;
TableFunctionImplementation<?> functionImplementation = phase.functionImplementation();
RowType rowType = functionImplementation.returnType();
//noinspection unchecked Only literals can be passed to table func... | 160 | 491 | 651 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/collect/stats/NodeStatsRequest.java | StatsRequest | writeTo | class StatsRequest extends TransportRequest {
private final Set<ColumnIdent> columns;
private StatsRequest(Set<ColumnIdent> columns) {
this.columns = columns;
}
public Set<ColumnIdent> columnIdents() {
return columns;
}
StatsRequest(StreamInput... |
super.writeTo(out);
out.writeVInt(columns.size());
for (ColumnIdent columnIdent : columns) {
columnIdent.writeTo(out);
}
| 185 | 49 | 234 | <methods>public void <init>(java.lang.String, io.crate.execution.engine.collect.stats.NodeStatsRequest.StatsRequest) ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public io.crate.execution.engine.collect.stats.NodeStatsRequest.StatsRequest innerRequest() ,public java.lan... |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/distribution/BroadcastingBucketBuilder.java | BroadcastingBucketBuilder | build | class BroadcastingBucketBuilder implements MultiBucketBuilder {
private final int numBuckets;
private final StreamBucket.Builder bucketBuilder;
public BroadcastingBucketBuilder(Streamer<?>[] streamers, int numBuckets, RamAccounting ramAccounting) {
this.numBuckets = numBuckets;
this.bucket... |
assert buckets.length == numBuckets : "length of the provided array must match numBuckets";
StreamBucket bucket = bucketBuilder.build();
bucketBuilder.reset();
for (int i = 0; i < numBuckets; i++) {
buckets[i] = bucket;
}
| 220 | 81 | 301 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/distribution/DistributedResultRequest.java | Builder | of | class Builder {
public final DistributedResultRequest innerRequest;
public Builder(UUID jobId, int executionPhaseId, byte inputId, int bucketIdx, Throwable throwable, boolean isKilled) {
this.innerRequest = new DistributedResultRequest(jobId, executionPhaseId, inputId, bucketIdx, throwable... |
return new NodeRequest<>(
nodeId,
new DistributedResultRequest(jobId, executionPhaseId, inputId, bucketIdx, rows, isLast)
);
| 207 | 47 | 254 | <methods>public void <init>() ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public org.elasticsearch.tasks.TaskId getParentTask() ,public void setParentTask(org.elasticsearch.tasks.TaskId) ,public void writeTo(org.elasticsearch.common.io.stream.StreamOutput) throws java.... |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/distribution/ModuloBucketBuilder.java | ModuloBucketBuilder | hashCode | class ModuloBucketBuilder implements MultiBucketBuilder {
private final int numBuckets;
private final List<StreamBucket.Builder> bucketBuilders;
private final int distributedByColumnIdx;
private int size = 0;
public ModuloBucketBuilder(Streamer<?>[] streamers, int numBuckets, int distributedByColu... |
if (value == null) {
return 0;
}
return value.hashCode();
| 590 | 29 | 619 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/distribution/SingleBucketBuilder.java | SingleBucketBuilder | accept | class SingleBucketBuilder implements RowConsumer, CompletionListenable<StreamBucket> {
private final Streamer<?>[] streamers;
private RamAccounting ramAccounting;
private final CompletableFuture<StreamBucket> bucketFuture = new CompletableFuture<>();
public SingleBucketBuilder(Streamer<?>[] streamers,... |
if (failure == null) {
StreamBucketCollector streamBucketCollector = new StreamBucketCollector(streamers, ramAccounting);
BatchIterators.collect(iterator, streamBucketCollector.supplier().get(), streamBucketCollector, bucketFuture);
} else {
if (iterator != null) {
... | 186 | 111 | 297 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/distribution/merge/BatchPagingIterator.java | BatchPagingIterator | close | class BatchPagingIterator<Key> implements BatchIterator<Row> {
private final PagingIterator<Key, Row> pagingIterator;
private final Function<Key, KillableCompletionStage<? extends Iterable<? extends KeyIterable<Key, Row>>>> fetchMore;
private final BooleanSupplier isUpstreamExhausted;
private final Con... |
if (!closed) {
closed = true;
pagingIterator.finish(); // release resource, specially possible ram accounted bytes
closeCallback.accept(killed);
}
| 1,031 | 48 | 1,079 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/distribution/merge/RamAccountingPageIterator.java | RamAccountingPageIterator | merge | class RamAccountingPageIterator<TKey> implements PagingIterator<TKey, Row> {
@VisibleForTesting
final PagingIterator<TKey, Row> delegatePagingIterator;
private final RowAccounting<Row> rowAccounting;
public RamAccountingPageIterator(PagingIterator<TKey, Row> delegatePagingIterator, RowAccounting<Row> ... |
for (KeyIterable<TKey, Row> iterable : keyIterables) {
for (Row row : iterable) {
rowAccounting.accountForAndMaybeBreak(row);
}
}
delegatePagingIterator.merge(keyIterables);
| 309 | 68 | 377 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/export/LocalFsFileOutput.java | LocalFsFileOutput | acquireOutputStream | class LocalFsFileOutput implements FileOutput {
@Override
public OutputStream acquireOutputStream(Executor executor, URI uri, WriterProjection.CompressionType compressionType) throws IOException {<FILL_FUNCTION_BODY>}
} |
if (uri.getHost() != null) {
throw new IllegalArgumentException("the URI host must be defined");
}
String path = uri.getPath();
File outFile = new File(path);
if (outFile.exists()) {
if (outFile.isDirectory()) {
throw new IOException("Outp... | 59 | 148 | 207 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/fetch/FetchCollector.java | FetchCollector | collect | class FetchCollector {
private final LuceneCollectorExpression[] collectorExpressions;
private final InputRow row;
private final Streamer<?>[] streamers;
private final RamAccounting ramAccounting;
private final int readerId;
private final FetchTask fetchTask;
FetchCollector(List<LuceneColl... |
boolean collectSequential = isSequential(docIds);
StreamBucket.Builder builder = new StreamBucket.Builder(streamers, ramAccounting);
try (var borrowed = fetchTask.searcher(readerId)) {
var searcher = borrowed.item();
List<LeafReaderContext> leaves = searcher.getTopReader... | 679 | 437 | 1,116 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/fetch/FetchProjector.java | FetchProjector | create | class FetchProjector {
private static final long MIN_BYTES_PER_BUCKETS = ByteSizeUnit.KB.toBytes(64);
// We only know the memory of the incoming rows up-front, so the percentage is low
// to leave space for the cells being fetched.
private static final double BREAKER_LIMIT_PERCENTAGE = 0.20d;
pub... |
final FetchRows fetchRows = FetchRows.create(
txnCtx,
nodeCtx,
projection.fetchSources(),
projection.outputSymbols()
);
CellsSizeEstimator estimateRowSize = CellsSizeEstimator.forColumns(projection.inputTypes());
return (BatchIterator<Row>... | 256 | 259 | 515 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/fetch/FetchRows.java | FetchRows | updatedOutputRow | class FetchRows {
public static FetchRows create(TransactionContext txnCtx,
NodeContext nodeCtx,
Map<RelationName, FetchSource> fetchSourceByTable,
List<Symbol> outputSymbols) {
IntArrayList fetchIdPosi... |
for (int i = 0; i < fetchIdPositions.length; i++) {
int fetchIdPos = fetchIdPositions[i];
Long fetchId = (Long) incomingCells[fetchIdPos];
UnsafeArrayRow fetchedRow = fetchedRows.get(fetchIdPos);
if (fetchId == null) {
fetchedRow.cells(nullRows.ge... | 895 | 244 | 1,139 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/fetch/NodeFetchOperation.java | TableFetchInfo | fetch | class TableFetchInfo {
private final Streamer<?>[] streamers;
private final Collection<Reference> refs;
private final FetchTask fetchTask;
TableFetchInfo(Collection<Reference> refs, FetchTask fetchTask) {
this.refs = refs;
this.fetchTask = fetchTask;
... |
if (docIdsToFetch == null) {
if (closeTaskOnFinish) {
tryCloseTask(jobId, phaseId);
}
jobsLogs.operationStarted(phaseId, jobId, "fetch", () -> -1);
jobsLogs.operationFinished(phaseId, jobId, null);
return CompletableFuture.completedFut... | 490 | 370 | 860 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/fetch/NodeFetchRequest.java | FetchRequest | writeTo | class FetchRequest extends TransportRequest {
private final UUID jobId;
private final int fetchPhaseId;
private final boolean closeContext;
@Nullable
private final IntObjectMap<IntArrayList> toFetch;
private FetchRequest(UUID jobId,
int fetchPhaseI... |
super.writeTo(out);
out.writeLong(jobId.getMostSignificantBits());
out.writeLong(jobId.getLeastSignificantBits());
out.writeVInt(fetchPhaseId);
out.writeBoolean(closeContext);
if (toFetch == null) {
out.writeVInt(0);
} ... | 551 | 203 | 754 | <methods>public void <init>(java.lang.String, io.crate.execution.engine.fetch.NodeFetchRequest.FetchRequest) ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public io.crate.execution.engine.fetch.NodeFetchRequest.FetchRequest innerRequest() ,public java.lang.String nodeId(... |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/fetch/TransportFetchNodeAction.java | TransportFetchNodeAction | nodeOperation | class TransportFetchNodeAction extends TransportAction<NodeFetchRequest, NodeFetchResponse> {
private final Transports transports;
private final NodeFetchOperation nodeFetchOperation;
@Inject
public TransportFetchNodeAction(Settings settings,
TransportService transp... |
CompletableFuture<? extends IntObjectMap<StreamBucket>> resultFuture = nodeFetchOperation.fetch(
request.jobId(),
request.fetchPhaseId(),
request.toFetch(),
request.isCloseContext()
);
return resultFuture.thenApply(NodeFetchResponse::new);
| 501 | 80 | 581 | <methods>public final CompletableFuture<io.crate.execution.engine.fetch.NodeFetchResponse> execute(io.crate.execution.engine.fetch.NodeFetchRequest) ,public final CompletableFuture<T> execute(io.crate.execution.engine.fetch.NodeFetchRequest, Function<? super io.crate.execution.engine.fetch.NodeFetchResponse,? extends T... |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/fetch/TransportFetchOperation.java | TransportFetchOperation | ramAccountingForIncomingResponse | class TransportFetchOperation implements FetchOperation {
private static final Function<NodeFetchResponse, IntObjectMap<? extends Bucket>> GET_FETCHED = NodeFetchResponse::fetched;
private final ActionExecutor<NodeFetchRequest, NodeFetchResponse> fetchNodeAction;
private final Map<String, ? extends IntObje... |
if (toFetch.isEmpty() && closeContext) {
// No data will arrive, so no ram accounting needed.
// Indeed, with valid ram accounting, incoming accounted bytes may never be released because the release
// logic may already happened (BatchAccumulator.close() calls do not block/w... | 521 | 217 | 738 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/indexing/BulkShardCreationLimiter.java | BulkShardCreationLimiter | test | class BulkShardCreationLimiter implements Predicate<ShardedRequests<?, ?>> {
/**
* Defines the maximum number of new shards per node which can be safely created before running into the
* <p>wait_for_active_shards</p> timeout of 30sec. Value was wisely chosen after some brave testing.
*/
static f... |
if (requests.itemsByMissingIndex.isEmpty() == false) {
int numberOfShardForAllIndices = numberOfAllShards * requests.itemsByMissingIndex.size();
int numberOfShardsPerNode = numberOfShardForAllIndices / numDataNodes;
if (numberOfShardsPerNode >= MAX_NEW_SHARDS_PER_NODE) {
... | 269 | 168 | 437 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/indexing/IndexNameResolver.java | IndexNameResolver | forPartition | class IndexNameResolver {
private IndexNameResolver() {
}
public static Supplier<String> create(RelationName relationName,
@Nullable String partitionIdent,
@Nullable List<Input<?>> partitionedByInputs) {
if (partit... |
assert partitionedByInputs.size() > 0 : "must have at least 1 partitionedByInput";
final LoadingCache<List<String>, String> cache = Caffeine.newBuilder()
.executor(Runnable::run)
.initialCapacity(10)
.maximumSize(20)
.build(new CacheLoader<List<String>, S... | 274 | 212 | 486 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/indexing/IndexWriterProjector.java | MapInput | value | class MapInput implements Input<String> {
private final Input<Map<String, Object>> sourceInput;
private final String[] excludes;
private static final Logger LOGGER = LogManager.getLogger(MapInput.class);
private int lastSourceSize;
private MapInput(Input<Map<String, Object>> so... |
Map<String, Object> value = sourceInput.value();
if (value == null) {
return null;
}
assert value instanceof LinkedHashMap<String, Object> : "the raw source order should be preserved";
if (excludes != null) {
for (String exclud... | 160 | 225 | 385 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/indexing/ShardLocation.java | ShardLocation | hashCode | class ShardLocation {
final ShardId shardId;
final String nodeId;
public ShardLocation(ShardId shardId, String nodeId) {
this.shardId = shardId;
this.nodeId = nodeId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getC... |
int result = shardId.hashCode();
result = 31 * result + (nodeId != null ? nodeId.hashCode() : 0);
return result;
| 208 | 46 | 254 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/indexing/ShardedRequests.java | ReadFailureAndLineNumber | toString | class ReadFailureAndLineNumber {
final String readFailure;
final long lineNumber;
ReadFailureAndLineNumber(String readFailure, long lineNumber) {
this.readFailure = readFailure;
this.lineNumber = lineNumber;
}
}
@Override
public void close() {
... |
return "ShardedRequests{"
+ "numShards=" + itemsByShard.size()
+ ", bytesUsed=" + usedMemoryEstimate
+ ", sizePerShard=" + usedMemoryEstimate / Math.max(1, itemsByShard.size())
+ "}";
| 129 | 77 | 206 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/indexing/UpsertResultCollectors.java | SummaryCollector | processShardResponse | class SummaryCollector implements UpsertResultCollector {
private final Map<String, String> nodeInfo;
private final Object lock = new Object();
SummaryCollector(Map<String, String> nodeInfo) {
this.nodeInfo = nodeInfo;
}
@Override
public Supplier<UpsertRes... |
synchronized (lock) {
List<ShardResponse.Failure> failures = shardResponse.failures();
IntArrayList locations = shardResponse.itemIndices();
for (int i = 0; i < failures.size(); i++) {
ShardResponse.Failure failure = failures.get(i);
... | 291 | 154 | 445 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/join/NestedLoopOperation.java | NestedLoopOperation | buildCrossJoinBatchIterator | class NestedLoopOperation implements CompletionListenable {
private final CapturingRowConsumer leftConsumer;
private final CapturingRowConsumer rightConsumer;
private final RowConsumer resultConsumer;
public NestedLoopOperation(int numLeftCols,
int numRightCols,
... |
if (blockNestedLoop) {
var blockSizeCalculator = new RamBlockSizeCalculator(
Paging.PAGE_SIZE,
circuitBreaker,
estimatedRowsSizeLeft
);
var rowAccounting = new TypedCellsAccounting(leftSideColumnTypes, ramAccounting, 0);
... | 1,087 | 133 | 1,220 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/sort/InputFieldComparator.java | InputFieldComparator | copy | class InputFieldComparator extends FieldComparator<Object> implements LeafFieldComparator {
private final Object[] values;
private final Input<?> input;
private final List<? extends LuceneCollectorExpression<?>> collectorExpressions;
private final Comparator<Object> comparator;
private final @Nulla... |
for (int i = 0; i < collectorExpressions.size(); i++) {
collectorExpressions.get(i).setNextDocId(doc);
}
Object value = input.value();
if (value == null) {
values[slot] = missingValue;
} else {
values[slot] = value;
}
| 714 | 93 | 807 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/sort/OrderingByPosition.java | OrderingByPosition | rowOrdering | class OrderingByPosition {
public static Comparator<Object[]> arrayOrdering(RoutedCollectPhase collectPhase) {
OrderBy orderBy = collectPhase.orderBy();
assert orderBy != null : "collectPhase must have an orderBy clause to generate an ordering";
int[] positions = OrderByPositionVisitor.ord... |
int[] positions = OrderByPositionVisitor.orderByPositions(orderBy.orderBySymbols(), toCollect);
return rowOrdering(Symbols.typeView(toCollect), positions, orderBy.reverseFlags(), orderBy.nullsFirst());
| 831 | 63 | 894 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/sort/UnboundedSortingLimitAndOffsetCollector.java | UnboundedSortingLimitAndOffsetCollector | pqToIterable | class UnboundedSortingLimitAndOffsetCollector implements Collector<Row, PriorityQueue<Object[]>, Bucket> {
private final Collection<? extends Input<?>> inputs;
private final Iterable<? extends CollectExpression<Row, ?>> expressions;
private final int numOutputs;
private final Comparator<Object[]> compa... |
if (offset > pq.size()) {
return new ArrayBucket(new Object[0][0], numOutputs);
}
int resultSize = Math.max(Math.min(maxNumberOfRowsInQueue - offset, pq.size() - offset), 0);
Object[][] rows = new Object[resultSize][];
for (int i = resultSize - 1; i >= 0; i--) {
... | 1,172 | 137 | 1,309 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/window/ArithmeticOperatorsFactory.java | ArithmeticOperatorsFactory | getSubtractFunction | class ArithmeticOperatorsFactory {
private static final BinaryOperator<Double> ADD_DOUBLE_FUNCTION = Double::sum;
private static final BinaryOperator<Integer> ADD_INTEGER_FUNCTION = Integer::sum;
private static final BinaryOperator<Long> ADD_LONG_FUNCTION = Long::sum;
private static final BinaryOperato... |
switch (fstArgDataType.id()) {
case LongType.ID:
case TimestampType.ID_WITH_TZ:
case TimestampType.ID_WITHOUT_TZ:
if (IntervalType.ID == sndArgDataType.id()) {
var signature = IntervalTimestampArithmeticScalar.signatureFor(
... | 600 | 277 | 877 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/window/RowNumberWindowFunction.java | RowNumberWindowFunction | execute | class RowNumberWindowFunction implements WindowFunction {
private static final String NAME = "row_number";
public static void register(Functions.Builder builder) {
builder.add(
Signature.window(
NAME,
DataTypes.INTEGER.getTypeSignature()
),
... |
if (ignoreNulls != null) {
throw new IllegalArgumentException("row_number cannot accept RESPECT or IGNORE NULLS flag.");
}
return idxInPartition + 1;
| 262 | 50 | 312 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/engine/window/WindowFunctionBatchIterator.java | WindowFunctionBatchIterator | next | class WindowFunctionBatchIterator {
private static final Logger LOGGER = LogManager.getLogger(WindowFunctionBatchIterator.class);
public static BatchIterator<Row> of(BatchIterator<Row> source,
RowAccounting<Row> rowAccounting,
Com... |
if (!hasNext()) {
throw new NoSuchElementException();
}
if (i == pEnd) {
pStart = i;
idxInPartition = 0;
pEnd = findFirstNonPeer(sortedRows, pStart, end, cmpPartitionBy);
}
... | 1,642 | 290 | 1,932 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/jobs/CountTask.java | CountTask | innerKill | class CountTask extends AbstractTask {
private final CountPhase countPhase;
private final TransactionContext txnCtx;
private final CountOperation countOperation;
private final RowConsumer consumer;
private final Map<String, IntIndexedContainer> indexShardMap;
private CompletableFuture<Long> cou... |
if (countFuture == null) {
consumer.accept(null, throwable);
} else {
killReason = throwable;
countFuture.cancel(true);
}
| 498 | 49 | 547 | <methods>public CompletableFuture<java.lang.Void> completionFuture() ,public int id() ,public final void kill(java.lang.Throwable) ,public final CompletableFuture<java.lang.Void> start() <variables>private final java.util.concurrent.atomic.AtomicBoolean firstClose,private final CompletableFuture<java.lang.Void> future,... |
crate_crate | crate/server/src/main/java/io/crate/execution/jobs/kill/TransportKillNodeAction.java | TransportKillNodeAction | broadcast | class TransportKillNodeAction {
private TransportKillNodeAction() {
}
static <T extends TransportRequest> void broadcast(ClusterService clusterService,
TransportService transportService,
T request... |
Stream<DiscoveryNode> nodes = StreamSupport.stream(clusterService.state().nodes().spliterator(), false);
Collection<DiscoveryNode> filteredNodes = nodes.filter(node -> !excludedNodeIds.contains(node.getId())).collect(
Collectors.toList());
MultiActionListener<KillResponse, Long, Ki... | 99 | 208 | 307 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/jobs/transport/NodeDisconnectJobMonitorService.java | NodeDisconnectJobMonitorService | broadcastKillToParticipatingNodes | class NodeDisconnectJobMonitorService extends AbstractLifecycleComponent implements TransportConnectionListener {
private final TasksService tasksService;
private final NodeLimits nodeLimits;
private final TransportService transportService;
private final ActionExecutor<KillJobsNodeRequest, KillRespons... |
List<UUID> affectedJobs = tasksService
.getJobIdsByParticipatingNodes(deadNode.getId()).collect(Collectors.toList());
if (affectedJobs.isEmpty()) {
return;
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug(
"Broadcasting kill for {} jobs b... | 1,030 | 263 | 1,293 | <methods>public void addLifecycleListener(org.elasticsearch.common.component.LifecycleListener) ,public void close() ,public org.elasticsearch.common.component.Lifecycle.State lifecycleState() ,public void removeLifecycleListener(org.elasticsearch.common.component.LifecycleListener) ,public void start() ,public void st... |
crate_crate | crate/server/src/main/java/io/crate/execution/jobs/transport/TransportCancelAction.java | TransportCancelAction | doExecute | class TransportCancelAction extends TransportAction<CancelRequest, AcknowledgedResponse> {
public static final String NAME = "internal:crate:pg/cancel";
public static final ActionType<AcknowledgedResponse> ACTION = new ActionType<>(NAME);
private final Sessions sessions;
private final ClusterService cl... |
DiscoveryNodes nodes = clusterService.state().nodes();
var multiActionListener = new MultiActionListener<>(
nodes.getSize() - 1, // localNode is excluded
() -> null,
(x, y) -> {},
state -> new AcknowledgedResponse(true),
finalListener
... | 329 | 163 | 492 | <methods>public final CompletableFuture<org.elasticsearch.action.support.master.AcknowledgedResponse> execute(io.crate.execution.jobs.transport.CancelRequest) ,public final CompletableFuture<T> execute(io.crate.execution.jobs.transport.CancelRequest, Function<? super org.elasticsearch.action.support.master.Acknowledged... |
crate_crate | crate/server/src/main/java/io/crate/execution/jobs/transport/TransportJobAction.java | TransportJobAction | maybeInstrumentProfiler | class TransportJobAction extends TransportAction<NodeRequest<JobRequest>, JobResponse> {
private final IndicesService indicesService;
private final Transports transports;
private final TasksService tasksService;
private final JobSetup jobSetup;
@Inject
public TransportJobAction(TransportServic... |
if (enableProfiling) {
var profilers = new ArrayList<QueryProfiler>();
ProfilingContext profilingContext = new ProfilingContext(profilers);
contextBuilder.profilingContext(profilingContext);
return new SharedShardContexts(
indicesService,
... | 621 | 174 | 795 | <methods>public final CompletableFuture<io.crate.execution.jobs.transport.JobResponse> execute(NodeRequest<io.crate.execution.jobs.transport.JobRequest>) ,public final CompletableFuture<T> execute(NodeRequest<io.crate.execution.jobs.transport.JobRequest>, Function<? super io.crate.execution.jobs.transport.JobResponse,?... |
crate_crate | crate/server/src/main/java/io/crate/execution/support/ActionListeners.java | ActionListeners | waitForShards | class ActionListeners {
private ActionListeners() {
}
public static <T extends AcknowledgedResponse> ActionListener<T> waitForShards(ActionListener<T> delegate,
ActiveShardsObserver observer,
... |
return ActionListener.wrap(
resp -> {
if (resp.isAcknowledged()) {
observer.waitForActiveShards(
indices.get(),
ActiveShardCount.DEFAULT,
timeout,
shardsAcknowledged ... | 106 | 149 | 255 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/support/OneRowActionListener.java | OneRowActionListener | accept | class OneRowActionListener<Response> implements ActionListener<Response>, BiConsumer<Response, Throwable> {
private final RowConsumer consumer;
private final Function<? super Response, ? extends Row> toRowFunction;
public static OneRowActionListener<? super AcknowledgedResponse> oneIfAcknowledged(RowConsu... |
if (t == null) {
onResponse(response);
} else {
consumer.accept(null, t);
}
| 332 | 37 | 369 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/support/RetryRunnable.java | RetryRunnable | run | class RetryRunnable implements Runnable, Scheduler.Cancellable {
private static final Logger LOGGER = LogManager.getLogger(RetryRunnable.class);
private final ThreadPool threadPool;
private final String executorName;
private final Executor executor;
private final Iterator<TimeValue> delay;
pri... |
try {
executor.execute(retryCommand);
} catch (EsRejectedExecutionException e) {
if (delay.hasNext()) {
long currentDelay = delay.next().millis();
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Received RejectedExecutionException... | 334 | 200 | 534 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/execution/support/Transports.java | Transports | sendRequest | class Transports {
private final ClusterService clusterService;
private final TransportService transportService;
@Inject
public Transports(ClusterService clusterService, TransportService transportService) {
this.clusterService = clusterService;
this.transportService = transportService;... |
DiscoveryNode discoveryNode = clusterService.state().nodes().get(node);
if (discoveryNode == null) {
listener.onFailure(new NodeNotConnectedException(null,
String.format(Locale.ENGLISH, "node \"%s\" not found in cluster state!", node)));
return;
}
... | 236 | 137 | 373 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/expression/RowFilter.java | RowFilter | create | class RowFilter implements Predicate<Row> {
private final Input<Boolean> filterCondition;
private final List<CollectExpression<Row, ?>> expressions;
public static Predicate<Row> create(TransactionContext txnCtx, InputFactory inputFactory, @Nullable Symbol filterSymbol) {<FILL_FUNCTION_BODY>}
private ... |
if (filterSymbol == null) {
return i -> true;
}
return new RowFilter(txnCtx, inputFactory, filterSymbol);
| 427 | 42 | 469 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/expression/eval/NullEliminator.java | Visitor | visitFunction | class Visitor extends FunctionCopyVisitor<Context> {
@Override
public Symbol visitFunction(Function func, Context context) {<FILL_FUNCTION_BODY>}
@Override
public Symbol visitLiteral(Literal<?> symbol, Context context) {
if (context.insideLogicalOperator && symbol.value() =... |
String functionName = func.name();
// only operate inside logical operators
if (Operators.LOGICAL_OPERATORS.contains(functionName)) {
final boolean currentNullReplacement = context.nullReplacement;
final boolean currentInsideLogicalOperator = context... | 114 | 246 | 360 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/expression/operator/AndOperator.java | AndOperator | of | class AndOperator extends Operator<Boolean> {
public static final String NAME = "op_and";
public static final Signature SIGNATURE = Signature.scalar(
NAME,
DataTypes.BOOLEAN.getTypeSignature(),
DataTypes.BOOLEAN.getTypeSignature(),
DataTypes.BOOLEAN.getTypeSignature()
);
... |
assert first.valueType().equals(DataTypes.BOOLEAN) || first.valueType().equals(DataTypes.UNDEFINED) :
"first symbol must have BOOLEAN return type to create AND function";
assert second.valueType().equals(DataTypes.BOOLEAN) || second.valueType().equals(DataTypes.UNDEFINED) :
"sec... | 1,470 | 136 | 1,606 | <methods>public io.crate.expression.symbol.Symbol normalizeSymbol(io.crate.expression.symbol.Function, io.crate.metadata.TransactionContext, io.crate.metadata.NodeContext) <variables>public static final java.lang.String PREFIX,public static final io.crate.types.BooleanType RETURN_TYPE |
crate_crate | crate/server/src/main/java/io/crate/expression/operator/CmpOperator.java | CmpOperator | evaluate | class CmpOperator extends Operator<Object> {
private final IntPredicate isMatch;
private final DataType<Object> type;
@SuppressWarnings("unchecked")
public CmpOperator(Signature signature, BoundSignature boundSignature, IntPredicate cmpResultIsMatch) {
super(signature, boundSignature);
... |
assert args != null : "args must not be null";
assert args.length == 2 : "number of args must be 2";
assert args[0] != null && args[1] != null : "1st and 2nd argument must not be null";
Object left = args[0].value();
Object right = args[1].value();
if (left == null || r... | 646 | 159 | 805 | <methods>public io.crate.expression.symbol.Symbol normalizeSymbol(io.crate.expression.symbol.Function, io.crate.metadata.TransactionContext, io.crate.metadata.NodeContext) <variables>public static final java.lang.String PREFIX,public static final io.crate.types.BooleanType RETURN_TYPE |
crate_crate | crate/server/src/main/java/io/crate/expression/operator/LikeOperator.java | LikeOperator | compile | class LikeOperator extends Operator<String> {
private final FourPredicate<String, String, Character, CaseSensitivity> matcher;
private final CaseSensitivity caseSensitivity;
private final java.util.function.Function<Input<String>[], Character> escapeFromInputs;
private final java.util.function.Functio... |
Symbol pattern = arguments.get(1);
if (pattern instanceof Input) {
Object value = ((Input<?>) pattern).value();
if (value == null) {
return this;
}
Character escapeChar = escapeFromSymbols.apply(arguments);
return new CompiledL... | 1,103 | 113 | 1,216 | <methods>public io.crate.expression.symbol.Symbol normalizeSymbol(io.crate.expression.symbol.Function, io.crate.metadata.TransactionContext, io.crate.metadata.NodeContext) <variables>public static final java.lang.String PREFIX,public static final io.crate.types.BooleanType RETURN_TYPE |
crate_crate | crate/server/src/main/java/io/crate/expression/operator/LtOperator.java | LtOperator | register | class LtOperator {
public static final String NAME = "op_<";
public static void register(Functions.Builder builder) {<FILL_FUNCTION_BODY>}
} |
for (var supportedType : DataTypes.PRIMITIVE_TYPES) {
builder.add(
Signature.scalar(
NAME,
supportedType.getTypeSignature(),
supportedType.getTypeSignature(),
Operator.RETURN_TYPE.getTypeSignature()
... | 49 | 126 | 175 | <no_super_class> |
crate_crate | crate/server/src/main/java/io/crate/expression/operator/Operator.java | Operator | normalizeSymbol | class Operator<I> extends Scalar<Boolean, I> {
public static final BooleanType RETURN_TYPE = DataTypes.BOOLEAN;
public static final String PREFIX = "op_";
protected Operator(Signature signature, BoundSignature boundSignature) {
super(signature, boundSignature);
}
@Override
public Symb... |
// all operators evaluates to NULL if one argument is NULL
// let's handle this here to prevent unnecessary collect operations
for (Symbol symbol : function.arguments()) {
if (symbol instanceof Input && ((Input<?>) symbol).value() == null) {
return Literal.of(RETURN_... | 126 | 106 | 232 | <methods>public BoundSignature boundSignature() ,public Scalar<java.lang.Boolean,I> compile(List<io.crate.expression.symbol.Symbol>, java.lang.String, io.crate.role.Roles) ,public transient abstract java.lang.Boolean evaluate(io.crate.metadata.TransactionContext, io.crate.metadata.NodeContext, Input<I>[]) ,public io.cr... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.