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/metadata/pgcatalog/PgDepend.java
PgDepend
create
class PgDepend { public static final RelationName NAME = new RelationName(PgCatalogSchemaInfo.NAME, "pg_depend"); private PgDepend() {} public static SystemTable<Void> create() {<FILL_FUNCTION_BODY>} }
// https://www.postgresql.org/docs/current/catalog-pg-depend.html return SystemTable.<Void>builder(NAME) .add("classid", DataTypes.INTEGER, c -> null) .add("objid", DataTypes.INTEGER, c -> null) .add("objsubid", DataTypes.INTEGER, c -> null) .add("refclas...
73
193
266
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/metadata/pgcatalog/PgEnumTable.java
PgEnumTable
create
class PgEnumTable { public static final RelationName IDENT = new RelationName(PgCatalogSchemaInfo.NAME, "pg_enum"); private PgEnumTable() {} public static SystemTable<Void> create() {<FILL_FUNCTION_BODY>} }
return SystemTable.<Void>builder(IDENT) .add("oid", INTEGER, ignored -> null) .add("enumtypid", INTEGER, ignored -> null) .add("enumsortorder", DataTypes.FLOAT, ignored -> null) .add("enumlabel", STRING, ignored -> null) .build();
76
94
170
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/metadata/pgcatalog/PgIndexTable.java
PgIndexTable
create
class PgIndexTable { public static final RelationName IDENT = new RelationName(PgCatalogSchemaInfo.NAME, "pg_index"); private PgIndexTable() {} public static SystemTable<Entry> create() {<FILL_FUNCTION_BODY>} public static final class Entry { final Regclass indRelId; final Regclass ...
return SystemTable.<Entry>builder(IDENT) .add("indexrelid", REGCLASS, x -> x.indexRelId) .add("indrelid", REGCLASS, x -> x.indRelId) .add("indnatts", SHORT, x -> (short) 0) .add("indnkeyatts", SHORT, x -> (short) 0) .add("indisunique", BOOLEAN, x -> f...
179
421
600
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/metadata/pgcatalog/PgLocksTable.java
PgLocksTable
create
class PgLocksTable { public static final RelationName IDENT = new RelationName(PgCatalogSchemaInfo.NAME, "pg_locks"); private PgLocksTable() {} public static SystemTable<Void> create() {<FILL_FUNCTION_BODY>} }
return SystemTable.<Void>builder(IDENT) .add("locktype", DataTypes.STRING, x -> null) .add("database", DataTypes.INTEGER, x -> null) .add("relation", DataTypes.INTEGER, x -> null) .add("page", DataTypes.INTEGER, x -> null) .add("tuple", DataTypes.SHOR...
78
329
407
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/metadata/pgcatalog/PgSettingsTable.java
PgSettingsTable
create
class PgSettingsTable { public static final RelationName IDENT = new RelationName(PgCatalogSchemaInfo.NAME, "pg_settings"); private PgSettingsTable() {} public static SystemTable<NamedSessionSetting> create() {<FILL_FUNCTION_BODY>} }
return SystemTable.<NamedSessionSetting>builder(IDENT) .add("name", STRING, NamedSessionSetting::name) .add("setting", STRING, NamedSessionSetting::value) .add("unit", STRING, c -> null) .add("category", STRING, c -> null) .add("short_desc", STRING, N...
77
322
399
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/metadata/pgcatalog/PgShdescriptionTable.java
PgShdescriptionTable
create
class PgShdescriptionTable { public static final RelationName IDENT = new RelationName(PgCatalogSchemaInfo.NAME, "pg_shdescription"); private PgShdescriptionTable() {} public static SystemTable<Void> create() {<FILL_FUNCTION_BODY>} }
return SystemTable.<Void>builder(IDENT) .add("objoid", INTEGER, c -> null) .add("classoid", INTEGER, c -> null) .add("description", STRING , c -> null) .build();
79
71
150
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/metadata/settings/Validators.java
StrictStringValidator
validate
class StrictStringValidator implements Setting.Validator<String> { private final String key; StrictStringValidator(String key) { this.key = key; } @Override public void validate(String value) {<FILL_FUNCTION_BODY>} }
if (Booleans.isBoolean(value)) { throw new IllegalArgumentException(INVALID_MESSAGE + key + "'"); } try { Long.parseLong(value); throw new IllegalArgumentException(INVALID_MESSAGE + key + "'"); } catch (NumberFormatExceptio...
75
91
166
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/metadata/shard/unassigned/UnassignedShard.java
UnassignedShard
markAssigned
class UnassignedShard { public static boolean isUnassigned(int shardId) { return shardId < 0; } /** * valid shard ids are vom 0 to int.max * this method negates a shard id (0 becomes -1, 1 becomes -2, etc.) * <p> * if the given id is already negative it is returned as is *...
if (shard < 0) { return (shard * -1) - 1; } return shard;
637
36
673
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/metadata/sys/ClassifiedMetrics.java
Metrics
recordValue
class Metrics { private final Classification classification; private final LongAdder sumOfDurations = new LongAdder(); private final LongAdder failedCount = new LongAdder(); private final Recorder recorder; private final Histogram totalHistogram = new Histogram(HIGHEST_TRACKABL...
// We use start and end time to calculate the duration (since we track them anyway) // If the system time is adjusted this can lead to negative durations // so we protect here against it. recorder.recordValue(Math.min(Math.max(0, duration), HIGHEST_TRACKABLE_VALUE)); ...
368
142
510
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/metadata/sys/SysJobsTableInfo.java
SysJobsTableInfo
create
class SysJobsTableInfo { public static final RelationName IDENT = new RelationName(SysSchemaInfo.NAME, "jobs"); public static SystemTable<JobContext> create(Supplier<DiscoveryNode> localNode) {<FILL_FUNCTION_BODY>} }
return SystemTable.<JobContext>builder(IDENT) .add("id", STRING, c -> c.id().toString()) .add("username", STRING, JobContext::username) .startObject("node") .add("id", STRING, ignored -> localNode.get().getId()) .add("name", STRING, ignored ->...
75
190
265
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/metadata/sys/SysMetricsTableInfo.java
SysMetricsTableInfo
create
class SysMetricsTableInfo { public static final RelationName NAME = new RelationName(SysSchemaInfo.NAME, "jobs_metrics"); public static SystemTable<MetricsView> create(Supplier<DiscoveryNode> localNode) {<FILL_FUNCTION_BODY>} }
return SystemTable.<MetricsView>builder(NAME) .add("total_count", LONG, MetricsView::totalCount) .add("sum_of_durations", LONG, MetricsView::sumOfDurations) .add("failed_count", LONG, MetricsView::failedCount) .add("mean", DOUBLE, MetricsView::mean) ....
76
485
561
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/metadata/sys/SysRepositoriesTableInfo.java
SysRepositoriesTableInfo
create
class SysRepositoriesTableInfo { public static final RelationName IDENT = new RelationName(SysSchemaInfo.NAME, "repositories"); public static SystemTable<Repository> create(List<Setting<?>> maskedSettings) {<FILL_FUNCTION_BODY>} }
var maskedSettingNames = maskedSettings.stream().map(Setting::getKey).collect(Collectors.toSet()); return SystemTable.<Repository>builder(IDENT) .add("name", STRING, (Repository r) -> r.getMetadata().name()) .add("type", STRING, (Repository r) -> r.getMetadata().type()) ...
77
175
252
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/metadata/sys/SysTableDefinitions.java
SysTableDefinitions
registerTableDefinition
class SysTableDefinitions { private final Map<RelationName, StaticTableDefinition<?>> tableDefinitions = new HashMap<>(); @Inject public SysTableDefinitions(ClusterService clusterService, Roles roles, JobsLogs jobsLogs, ...
StaticTableDefinition<?> existingDefinition = tableDefinitions.putIfAbsent(relationName, definition); assert existingDefinition == null : "A static table definition is already registered for ident=" + relationName.toString();
1,554
56
1,610
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/metadata/tablefunctions/TableFunctionImplementation.java
TableFunctionImplementation
normalizeSymbol
class TableFunctionImplementation<T> extends Scalar<Iterable<Row>, T> { protected TableFunctionImplementation(Signature signature, BoundSignature boundSignature) { super(signature, boundSignature); } /** * An ObjectType which describes the result of the table function. * * This can ...
// Never normalize table functions; // The RelationAnalyzer expects a function symbol and can't deal with Literals return function;
260
37
297
<methods>public BoundSignature boundSignature() ,public Scalar<Iterable<io.crate.data.Row>,T> compile(List<io.crate.expression.symbol.Symbol>, java.lang.String, io.crate.role.Roles) ,public transient abstract Iterable<io.crate.data.Row> evaluate(io.crate.metadata.TransactionContext, io.crate.metadata.NodeContext, Input...
crate_crate
crate/server/src/main/java/io/crate/monitor/FsInfoHelpers.java
Stats
bytesRead
class Stats { public static Long readOperations(FsInfo.IoStats ioStats) { if (ioStats != null) { return ioStats.getTotalReadOperations(); } return -1L; } public static Long bytesRead(FsInfo.IoStats ioStats) {<FILL_FUNCTION_BODY>} pub...
if (ioStats != null) { return ioStats.getTotalReadKilobytes() * 1024L; } return -1L;
222
47
269
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/operation/collect/files/CSVLineParser.java
CSVLineParser
parse
class CSVLineParser { private final ByteArrayOutputStream out = new ByteArrayOutputStream(); private final ArrayList<String> headerKeyList = new ArrayList<>(); private String[] columnNamesArray; private final List<String> targetColumns; private final ObjectReader csvReader; public CSVLineParse...
MappingIterator<Object> iterator = csvReader.readValues(row.getBytes(StandardCharsets.UTF_8)); out.reset(); XContentBuilder jsonBuilder = new XContentBuilder(JsonXContent.JSON_XCONTENT, out).startObject(); int i = 0, j = 0; while (iterator.hasNext()) { if (i >= heade...
832
254
1,086
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/AnalyzePlan.java
AnalyzePlan
executeOrFail
class AnalyzePlan implements Plan { AnalyzePlan() { } @Override public StatementType type() { return StatementType.MANAGEMENT; } @Override public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, ...
OneRowActionListener<AcknowledgedResponse> listener = new OneRowActionListener<>( consumer, req -> req.isAcknowledged() ? new Row1(1L) : new Row1(0L)); dependencies.analyzeAction().fetchSamplesThenGenerateAndPublishStats().whenComplete(listener);
112
84
196
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/CreateServerPlan.java
CreateServerPlan
executeOrFail
class CreateServerPlan implements Plan { private final ForeignDataWrappers foreignDataWrappers; private final AnalyzedCreateServer createServer; public CreateServerPlan(ForeignDataWrappers foreignDataWrappers, AnalyzedCreateServer createServer) { this.foreignDataWrapper...
CoordinatorTxnCtx transactionContext = plannerContext.transactionContext(); Function<Symbol, Object> convert = new SymbolEvaluator( transactionContext, plannerContext.nodeContext(), subQueryResults ).bind(params); Settings.Builder optionsBuilder = S...
186
474
660
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/DecommissionNodePlan.java
DecommissionNodePlan
boundNodeIdOrName
class DecommissionNodePlan implements Plan { private final AnalyzedDecommissionNode analyzedDecommissionNode; DecommissionNodePlan(AnalyzedDecommissionNode analyzedDecommissionNode) { this.analyzedDecommissionNode = analyzedDecommissionNode; } @Override public StatementType type() { ...
var boundedNodeIdOrName = SymbolEvaluator.evaluate( txnCtx, nodeCtx, decommissionNode.nodeIdOrName(), parameters, subQueryResults ); return DataTypes.STRING.sanitizeValue(boundedNodeIdOrName);
399
77
476
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/GCDangingArtifactsPlan.java
GCDangingArtifactsPlan
executeOrFail
class GCDangingArtifactsPlan implements Plan { @Override public StatementType type() { return StatementType.MANAGEMENT; } @Override public void executeOrFail(DependencyCarrier dependencies, PlannerContext plannerContext, RowConsum...
var listener = OneRowActionListener.oneIfAcknowledged(consumer); DeleteIndexRequest deleteRequest = new DeleteIndexRequest(IndexParts.DANGLING_INDICES_PREFIX_PATTERNS.toArray(new String[0])); dependencies.client().execute(DeleteIndexAction.INSTANCE, deleteRequest).whenComplete(listener);
103
90
193
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/MultiPhasePlan.java
MultiPhasePlan
executeOrFail
class MultiPhasePlan implements Plan { @VisibleForTesting protected final Plan rootPlan; @VisibleForTesting protected final Map<LogicalPlan, SelectSymbol> dependencies; public static Plan createIfNeeded(Plan rootPlan, Map<LogicalPlan, SelectSymbol> dependencies) { if (dependencies.isEmpty...
MultiPhaseExecutor.execute(dependencies, dependencyCarrier, plannerContext, params) .whenComplete((subQueryValues, failure) -> { if (failure == null) { rootPlan.execute(dependencyCarrier, plannerContext, consumer, params, subQueryValues); } else {...
247
94
341
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/UnionExecutionPlan.java
UnionExecutionPlan
equals
class UnionExecutionPlan implements ExecutionPlan, ResultDescription { private final ExecutionPlan left; private final ExecutionPlan right; private final MergePhase mergePhase; private int unfinishedLimit; private int unfinishedOffset; private int numOutputs; private final int maxRowsPer...
if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } UnionExecutionPlan that = (UnionExecutionPlan) o; return unfinishedLimit == that.unfinishedLimit && unfinishedOffset == that.unfinishedOf...
1,032
172
1,204
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/WhereClauseOptimizer.java
DetailedQuery
toBoundWhereClause
class DetailedQuery { private final Symbol query; private final DocKeys docKeys; private final List<List<Symbol>> partitions; private final Set<Symbol> clusteredByValues; private final boolean queryHasPkSymbolsOnly; DetailedQuery(Symbol query, DocK...
SubQueryAndParamBinder binder = new SubQueryAndParamBinder(params, subQueryResults); Symbol boundQuery = binder.apply(query); HashSet<Symbol> clusteredBy = HashSet.newHashSet(clusteredByValues.size()); for (Symbol clusteredByValue : clusteredByValues) { c...
487
250
737
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/consumer/CreateTableAsPlan.java
CreateTableAsPlan
of
class CreateTableAsPlan implements Plan { private final AnalyzedCreateTable analyzedCreateTable; private final Supplier<LogicalPlan> postponedInsertPlan; private final TableCreator tableCreator; private final NumberOfShards numberOfShards; public static CreateTableAsPlan of(AnalyzedCreateTableAs a...
Supplier<LogicalPlan> postponedInsertPlan = () -> logicalPlanner.plan(analyzedCreateTableAs.analyzePostponedInsertStatement(), context); return new CreateTableAsPlan( analyzedCreateTableAs.analyzedCreateTable(), postponedInsertPlan, tableCreator, ...
496
89
585
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/consumer/OrderByPositionVisitor.java
Context
orderByPositionsOrNull
class Context { final List<? extends Symbol> sourceSymbols; IntArrayList orderByPositions; public Context(List<? extends Symbol> sourceSymbols) { this.sourceSymbols = sourceSymbols; this.orderByPositions = new IntArrayList(); } public int[] orderByPositi...
Context context = new Context(outputSymbols); for (Symbol orderBySymbol : orderBySymbols) { orderBySymbol.accept(INSTANCE, context); } if (context.orderByPositions.size() == orderBySymbols.size()) { return context.orderByPositions(); } return null...
168
86
254
<methods>public non-sealed void <init>() ,public java.lang.Void visitAggregation(io.crate.expression.symbol.Aggregation, io.crate.planner.consumer.OrderByPositionVisitor.Context) ,public java.lang.Void visitAlias(io.crate.expression.symbol.AliasSymbol, io.crate.planner.consumer.OrderByPositionVisitor.Context) ,public j...
crate_crate
crate/server/src/main/java/io/crate/planner/distribution/DistributionInfo.java
DistributionInfo
hashCode
class DistributionInfo implements Writeable { public static final DistributionInfo DEFAULT_BROADCAST = new DistributionInfo(DistributionType.BROADCAST); public static final DistributionInfo DEFAULT_SAME_NODE = new DistributionInfo(DistributionType.SAME_NODE); public static final DistributionInfo DEFAULT_MO...
int result = distributionType.hashCode(); result = 31 * result + distributeByColumn; return result;
496
32
528
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/fetch/IndexBaseBuilder.java
IndexBaseBuilder
allocate
class IndexBaseBuilder { private final TreeMap<String, Integer> baseByIndex = new TreeMap<>(); public void allocate(String index, IntIndexedContainer shards) {<FILL_FUNCTION_BODY>} public TreeMap<String, Integer> build() { int currentBase = 0; for (Map.Entry<String, Integer> entry : baseB...
if (shards.isEmpty()) { return; } Integer currentMax = baseByIndex.get(index); int newMax = getMax(shards); if (currentMax == null || currentMax < newMax) { baseByIndex.put(index, newMax); }
220
78
298
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/node/dcl/GenericDCLPlan.java
GenericDCLPlan
executeOrFail
class GenericDCLPlan implements Plan { private final DCLStatement statement; public GenericDCLPlan(DCLStatement statement) { this.statement = statement; } @Override public StatementType type() { return StatementType.MANAGEMENT; } @Override public void executeOrFail(De...
executor.dclAction().apply(statement, params) .whenComplete(new OneRowActionListener<>(consumer, rCount -> new Row1(rCount == null ? -1 : rCount)));
139
53
192
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/node/ddl/AlterBlobTablePlan.java
AlterBlobTablePlan
executeOrFail
class AlterBlobTablePlan implements Plan { private final AnalyzedAlterBlobTable analyzedAlterTable; public AlterBlobTablePlan(AnalyzedAlterBlobTable analyzedAlterTable) { this.analyzedAlterTable = analyzedAlterTable; } @Override public StatementType type() { return StatementType.D...
Function<? super Symbol, Object> eval = x -> SymbolEvaluator.evaluate( plannerContext.transactionContext(), plannerContext.nodeContext(), x, params, subQueryResults ); TableInfo tableInfo = analyzedAlterTable.tableInfo(); Alte...
157
237
394
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/node/ddl/AlterTableDropColumnPlan.java
AlterTableDropColumnPlan
executeOrFail
class AlterTableDropColumnPlan implements Plan { private final AnalyzedAlterTableDropColumn alterTable; public AlterTableDropColumnPlan(AnalyzedAlterTableDropColumn alterTable) { this.alterTable = alterTable; } @Override public StatementType type() { return StatementType.DDL; ...
var dropColumnRequest = new DropColumnRequest(alterTable.table().ident(), alterTable.columns()); dependencies.alterTableOperation().executeAlterTableDropColumn(dropColumnRequest) .whenComplete(new OneRowActionListener<>(consumer, rCount -> new Row1(rCount == null ? -1 : rCount)));
152
81
233
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/node/ddl/AlterTableRenameColumnPlan.java
AlterTableRenameColumnPlan
executeOrFail
class AlterTableRenameColumnPlan implements Plan { private final AnalyzedAlterTableRenameColumn renameColumn; public AlterTableRenameColumnPlan(AnalyzedAlterTableRenameColumn alterTable) { this.renameColumn = alterTable; } @Override public Plan.StatementType type() { return Stateme...
var renameColumnRequest = new RenameColumnRequest(renameColumn.table(), renameColumn.refToRename(), renameColumn.newName()); dependencies.client() .execute(RenameColumnAction.INSTANCE, renameColumnRequest) .whenComplete(new OneRowActionListener<>(consumer, r -> r.isAcknowledged(...
158
106
264
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/node/ddl/CreateRepositoryPlan.java
CreateRepositoryPlan
createRequest
class CreateRepositoryPlan implements Plan { private final AnalyzedCreateRepository createRepository; public CreateRepositoryPlan(AnalyzedCreateRepository createRepository) { this.createRepository = createRepository; } @Override public StatementType type() { return StatementType.D...
Function<? super Symbol, Object> eval = x -> SymbolEvaluator.evaluate( txnCtx, nodeCtx, x, parameters, subQueryResults ); var genericProperties = createRepository.properties().map(eval); Map<String, Setting<?>> supportedSettin...
317
197
514
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/node/ddl/CreateRolePlan.java
CreateRolePlan
executeOrFail
class CreateRolePlan implements Plan { public static final String PASSWORD_PROPERTY_KEY = "password"; public static final String JWT_PROPERTY_KEY = "jwt"; private final AnalyzedCreateRole createRole; private final RoleManager roleManager; public CreateRolePlan(AnalyzedCreateRole createRole, Role...
Map<String, Object> properties = parse( createRole.properties(), plannerContext.transactionContext(), plannerContext.nodeContext(), params, subQueryResults ); SecureHash newPassword = UserActions.generateSecureHash(properties); ...
437
226
663
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/node/ddl/DropFunctionPlan.java
DropFunctionPlan
executeOrFail
class DropFunctionPlan implements Plan { private final AnalyzedDropFunction analyzedDropFunction; public DropFunctionPlan(AnalyzedDropFunction analyzedDropFunction) { this.analyzedDropFunction = analyzedDropFunction; } @Override public StatementType type() { return StatementType.D...
DropUserDefinedFunctionRequest request = new DropUserDefinedFunctionRequest( analyzedDropFunction.schema(), analyzedDropFunction.name(), analyzedDropFunction.argumentTypes(), analyzedDropFunction.ifExists() ); OneRowActionListener<AcknowledgedResp...
143
111
254
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/node/ddl/DropRepositoryPlan.java
DropRepositoryPlan
executeOrFail
class DropRepositoryPlan implements Plan { private final AnalyzedDropRepository dropRepository; public DropRepositoryPlan(AnalyzedDropRepository dropRepository) { this.dropRepository = dropRepository; } @Override public StatementType type() { return StatementType.DDL; } @...
dependencies.repositoryService().execute(new DeleteRepositoryRequest(dropRepository.name())) .whenComplete(new OneRowActionListener<>(consumer, rCount -> new Row1(rCount == null ? -1 : rCount)));
138
57
195
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/node/ddl/ResetSettingsPlan.java
ResetSettingsPlan
buildSettingsFrom
class ResetSettingsPlan implements Plan { private final AnalyzedResetStatement resetAnalyzedStatement; public ResetSettingsPlan(AnalyzedResetStatement resetAnalyzedStatement) { this.resetAnalyzedStatement = resetAnalyzedStatement; } @Override public StatementType type() { return S...
Settings.Builder settingsBuilder = Settings.builder(); for (Symbol symbol : settings) { String settingsName = eval.apply(symbol).toString(); List<String> settingNames = CrateSettings.settingNamesByPrefix(settingsName); if (settingNames.size() == 0) { ...
382
202
584
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/node/ddl/UpdateSettingsPlan.java
UpdateSettingsPlan
buildSettingsFrom
class UpdateSettingsPlan implements Plan { private final Collection<Assignment<Symbol>> settings; private final boolean isPersistent; public UpdateSettingsPlan(Collection<Assignment<Symbol>> settings, boolean isPersistent) { this.settings = settings; this.isPersistent = isPersistent; }...
Settings.Builder settingsBuilder = Settings.builder(); for (Assignment<Symbol> entry : assignments) { String settingsName = eval.apply(entry.columnName()).toString(); if (CrateSettings.isValidSetting(settingsName) == false) { throw new IllegalArgumentException("...
466
187
653
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/node/dml/DeleteById.java
DeleteRequests
addItem
class DeleteRequests implements ShardRequestExecutor.RequestGrouper<ShardDeleteRequest> { private final UUID jobId; private final TimeValue requestTimeout; DeleteRequests(UUID jobId, TimeValue requestTimeout) { this.jobId = jobId; this.requestTimeout = requestTimeout; ...
ShardDeleteRequest.Item item = new ShardDeleteRequest.Item(id); item.version(version); item.seqNo(seqNo); item.primaryTerm(primaryTerm); request.add(location, item);
228
61
289
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/node/dql/GroupByConsumer.java
GroupByConsumer
groupedByPrimaryKeys
class GroupByConsumer { public static boolean groupedByClusteredColumnOrPrimaryKeys(DocTableInfo tableInfo, WhereClause whereClause, List<Symbol> groupBySymbols) { if (groupBySymb...
if (groupBy.size() != primaryKeys.size()) { return false; } for (int i = 0, groupBySize = groupBy.size(); i < groupBySize; i++) { Symbol groupBySymbol = groupBy.get(i); if (groupBySymbol instanceof Reference ref) { ColumnIdent columnIdent = re...
304
150
454
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/node/management/AlterTableReroutePlan.java
InnerVisitor
visitReroutePromoteReplica
class InnerVisitor extends AnalyzedStatementVisitor<Context, AllocationCommand> { @Override protected AllocationCommand visitAnalyzedStatement(AnalyzedStatement analyzedStatement, Context context) { throw new UnsupportedOperationException( String.format(Locale.ENGLISH, "Can'...
var boundedPromoteReplica = statement.promoteReplica().map(context.eval); validateShardId(boundedPromoteReplica.shardId()); String index = getRerouteIndex( statement.shardedTable(), Lists.map(statement.partitionProperties(), x -> x.map(context.eval))...
1,294
206
1,500
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/node/management/KillPlan.java
KillPlan
execute
class KillPlan implements Plan { @Nullable private final Symbol jobId; public KillPlan(@Nullable Symbol jobId) { this.jobId = jobId; } @Override public StatementType type() { return StatementType.MANAGEMENT; } @Override public void executeOrFail(DependencyCarrier ...
if (jobId != null) { killJobsNodeAction .execute( new KillJobsNodeRequest( List.of(), List.of(jobId), userName, "KILL invoked by user: " + userName)) ....
504
179
683
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/operators/Distinct.java
Distinct
create
class Distinct { public static LogicalPlan create(LogicalPlan source, boolean distinct, List<Symbol> outputs) {<FILL_FUNCTION_BODY>} }
if (!distinct) { return source; } return new GroupHashAggregate(source, outputs, Collections.emptyList());
44
38
82
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/operators/EquiJoinDetector.java
Visitor
visitFunction
class Visitor extends SymbolVisitor<Context, Void> { @Override public Void visitFunction(Function function, Context context) {<FILL_FUNCTION_BODY>} @Override public Void visitField(ScopedSymbol field, Context context) { context.relations.add(field.relation()); r...
if (context.exit) { return null; } String functionName = function.name(); switch (functionName) { case NotPredicate.NAME -> { return null; } case OrOperator.NAME -> { ...
135
283
418
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/operators/Eval.java
Eval
create
class Eval extends ForwardingLogicalPlan { private final List<Symbol> outputs; public static LogicalPlan create(LogicalPlan source, List<Symbol> outputs) {<FILL_FUNCTION_BODY>} Eval(LogicalPlan source, List<Symbol> outputs) { super(source); this.outputs = outputs; } @Override ...
if (source.outputs().equals(outputs)) { return source; } return new Eval(source, outputs);
1,132
37
1,169
<methods>public void <init>(io.crate.planner.operators.LogicalPlan) ,public Map<io.crate.planner.operators.LogicalPlan,io.crate.expression.symbol.SelectSymbol> dependencies() ,public List<io.crate.expression.symbol.Symbol> outputs() ,public io.crate.planner.operators.LogicalPlan pruneOutputsExcept(SequencedCollection<i...
crate_crate
crate/server/src/main/java/io/crate/planner/operators/ForwardingLogicalPlan.java
ForwardingLogicalPlan
pruneOutputsExcept
class ForwardingLogicalPlan implements LogicalPlan { private final List<LogicalPlan> sources; final LogicalPlan source; public ForwardingLogicalPlan(LogicalPlan source) { this.source = source; this.sources = List.of(source); } public LogicalPlan source() { return source; ...
LogicalPlan newSource = source.pruneOutputsExcept(outputsToKeep); if (newSource == source) { return this; } return replaceSources(List.of(newSource));
278
57
335
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/operators/HashAggregate.java
HashAggregate
pruneOutputsExcept
class HashAggregate extends ForwardingLogicalPlan { private static final String MERGE_PHASE_NAME = "mergeOnHandler"; final List<Function> aggregates; HashAggregate(LogicalPlan source, List<Function> aggregates) { super(source); this.aggregates = aggregates; } @Override public ...
ArrayList<Function> newAggregates = new ArrayList<>(); for (Symbol outputToKeep : outputsToKeep) { SymbolVisitors.intersection(outputToKeep, aggregates, newAggregates::add); } LinkedHashSet<Symbol> toKeep = new LinkedHashSet<>(); for (Function newAggregate : newAggre...
1,660
173
1,833
<methods>public void <init>(io.crate.planner.operators.LogicalPlan) ,public Map<io.crate.planner.operators.LogicalPlan,io.crate.expression.symbol.SelectSymbol> dependencies() ,public List<io.crate.expression.symbol.Symbol> outputs() ,public io.crate.planner.operators.LogicalPlan pruneOutputsExcept(SequencedCollection<i...
crate_crate
crate/server/src/main/java/io/crate/planner/operators/JoinPlan.java
JoinPlan
replaceSources
class JoinPlan extends AbstractJoinPlan { private final boolean isFiltered; private final boolean rewriteFilterOnOuterJoinToInnerJoinDone; private final boolean lookUpJoinRuleApplied; private final boolean moveConstantJoinConditionRuleApplied; public JoinPlan(LogicalPlan lhs, L...
return new JoinPlan( sources.get(0), sources.get(1), joinType, joinCondition, isFiltered, rewriteFilterOnOuterJoinToInnerJoinDone, lookUpJoinRuleApplied, moveConstantJoinConditionRuleApplied );
1,299
76
1,375
<methods>public Map<io.crate.planner.operators.LogicalPlan,io.crate.expression.symbol.SelectSymbol> dependencies() ,public io.crate.expression.symbol.Symbol joinCondition() ,public io.crate.sql.tree.JoinType joinType() ,public io.crate.planner.operators.LogicalPlan lhs() ,public List<io.crate.expression.symbol.Symbol> ...
crate_crate
crate/server/src/main/java/io/crate/planner/operators/Limit.java
Limit
create
class Limit extends ForwardingLogicalPlan { final Symbol limit; final Symbol offset; static LogicalPlan create(LogicalPlan source, @Nullable Symbol limit, @Nullable Symbol offset) {<FILL_FUNCTION_BODY>} public Limit(LogicalPlan source, Symbol limit, Symbol offset) { super(source); thi...
if (limit == null && offset == null) { return source; } else { return new Limit( source, Objects.requireNonNullElse(limit, Literal.of(-1L)), Objects.requireNonNullElse(offset, Literal.of(0))); }
1,147
81
1,228
<methods>public void <init>(io.crate.planner.operators.LogicalPlan) ,public Map<io.crate.planner.operators.LogicalPlan,io.crate.expression.symbol.SelectSymbol> dependencies() ,public List<io.crate.expression.symbol.Symbol> outputs() ,public io.crate.planner.operators.LogicalPlan pruneOutputsExcept(SequencedCollection<i...
crate_crate
crate/server/src/main/java/io/crate/planner/operators/LimitDistinct.java
LimitDistinct
build
class LimitDistinct extends ForwardingLogicalPlan { private final Symbol limit; private final List<Symbol> outputs; private final Symbol offset; public LimitDistinct(LogicalPlan source, Symbol limit, Symbol offset, List<Symbol> outputs) { super(source); this.limit = limit; this...
var executionPlan = source.build( executor, plannerContext, planHints, projectionBuilder, LimitAndOffset.NO_LIMIT, LimitAndOffset.NO_OFFSET, null, null, params, subQueryResults ); ...
646
636
1,282
<methods>public void <init>(io.crate.planner.operators.LogicalPlan) ,public Map<io.crate.planner.operators.LogicalPlan,io.crate.expression.symbol.SelectSymbol> dependencies() ,public List<io.crate.expression.symbol.Symbol> outputs() ,public io.crate.planner.operators.LogicalPlan pruneOutputsExcept(SequencedCollection<i...
crate_crate
crate/server/src/main/java/io/crate/planner/operators/MultiPhase.java
MultiPhase
build
class MultiPhase extends ForwardingLogicalPlan { private final Map<LogicalPlan, SelectSymbol> subQueries; public static LogicalPlan createIfNeeded(Map<LogicalPlan, SelectSymbol> uncorrelatedSubQueries, LogicalPlan source) { if (uncorrelatedSubQueries.isEmpty()) { return source; } e...
return source.build( executor, plannerContext, planHints, projectionBuilder, limit, offset, order, pageSizeHint, params, subQueryResults);
480
43
523
<methods>public void <init>(io.crate.planner.operators.LogicalPlan) ,public Map<io.crate.planner.operators.LogicalPlan,io.crate.expression.symbol.SelectSymbol> dependencies() ,public List<io.crate.expression.symbol.Symbol> outputs() ,public io.crate.planner.operators.LogicalPlan pruneOutputsExcept(SequencedCollection<i...
crate_crate
crate/server/src/main/java/io/crate/planner/operators/Rename.java
Rename
pruneOutputsExcept
class Rename extends ForwardingLogicalPlan implements FieldResolver { private final List<Symbol> outputs; private final FieldResolver fieldResolver; final RelationName name; public Rename(List<Symbol> outputs, RelationName name, FieldResolver fieldResolver, LogicalPlan source) { super(source);...
/* In `SELECT * FROM (SELECT t1.*, t2.* FROM tbl AS t1, tbl AS t2) AS tjoin` * The `ScopedSymbol`s are ambiguous; To map them correctly this uses a IdentityHashMap */ IdentityHashMap<Symbol, Symbol> parentToChildMap = new IdentityHashMap<>(outputs.size()); IdentityHashMap<Symb...
1,428
420
1,848
<methods>public void <init>(io.crate.planner.operators.LogicalPlan) ,public Map<io.crate.planner.operators.LogicalPlan,io.crate.expression.symbol.SelectSymbol> dependencies() ,public List<io.crate.expression.symbol.Symbol> outputs() ,public io.crate.planner.operators.LogicalPlan pruneOutputsExcept(SequencedCollection<i...
crate_crate
crate/server/src/main/java/io/crate/planner/operators/StatementClassifier.java
Classification
toString
class Classification { private final Set<String> labels; private final Plan.StatementType type; public Classification(Plan.StatementType type, Set<String> labels) { this.type = type; this.labels = labels; } public Classification(Plan.StatementType type)...
return "Classification{type=" + type + ", labels=" + labels + "}";
281
26
307
<methods>public non-sealed void <init>() ,public java.lang.Void visitCollect(io.crate.planner.operators.Collect, Set<java.lang.String>) ,public java.lang.Void visitCorrelatedJoin(io.crate.planner.operators.CorrelatedJoin, Set<java.lang.String>) ,public java.lang.Void visitCount(io.crate.planner.operators.Count, Set<jav...
crate_crate
crate/server/src/main/java/io/crate/planner/optimizer/Optimizer.java
Optimizer
tryApplyRules
class Optimizer { private final List<Rule<?>> rules; private final Supplier<Version> minNodeVersionInCluster; private final NodeContext nodeCtx; public Optimizer(NodeContext nodeCtx, Supplier<Version> minNodeVersionInCluster, List<Rule<?>> rules) { thi...
LogicalPlan node = plan; // Some rules may only become applicable after another rule triggered, so we keep // trying to re-apply the rules as long as at least one plan was transformed. boolean done = false; int numIterations = 0; UnaryOperator<LogicalPlan> resolvePlan = ...
710
301
1,011
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/optimizer/iterative/IterativeOptimizer.java
IterativeOptimizer
exploreGroup
class IterativeOptimizer { private final List<Rule<?>> rules; private final Supplier<Version> minNodeVersionInCluster; private final NodeContext nodeCtx; public IterativeOptimizer(NodeContext nodeCtx, Supplier<Version> minNodeVersionInCluster, List<Rule<?>> rules) { this.rules = rules; ...
// tracks whether this group or any children groups change as // this method executes var progress = exploreNode(group, context); while (exploreChildren(group, context)) { progress = true; // This is an important part! We keep track // if the childre...
1,167
129
1,296
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/optimizer/joinorder/JoinGraph.java
GraphBuilder
visitJoinPlan
class GraphBuilder extends LogicalPlanVisitor<Map<Symbol, LogicalPlan>, JoinGraph> { private final UnaryOperator<LogicalPlan> resolvePlan; GraphBuilder(UnaryOperator<LogicalPlan> resolvePlan) { this.resolvePlan = resolvePlan; } @Override public JoinGraph visitPlan(...
var left = joinPlan.lhs().accept(this, context); var right = joinPlan.rhs().accept(this, context); if (joinPlan.joinType() == JoinType.CROSS) { return left.joinWith(right).withCrossJoin(true); } if (joinPlan.joinType() != JoinType.INNER) { ...
889
343
1,232
<methods>public non-sealed void <init>() ,public JoinGraph visitCollect(io.crate.planner.operators.Collect, Map<io.crate.expression.symbol.Symbol,io.crate.planner.operators.LogicalPlan>) ,public JoinGraph visitCorrelatedJoin(io.crate.planner.operators.CorrelatedJoin, Map<io.crate.expression.symbol.Symbol,io.crate.plann...
crate_crate
crate/server/src/main/java/io/crate/planner/optimizer/matcher/CapturePattern.java
CapturePattern
accept
class CapturePattern<T> extends Pattern<T> { private final Capture<T> capture; private final Pattern<T> pattern; CapturePattern(Capture<T> capture, Pattern<T> pattern) { this.capture = capture; this.pattern = pattern; } @Override public Match<T> accept(Object object, Captures ...
Match<T> match = pattern.accept(object, captures, resolvePlan); return match.flatMap(val -> Match.of(val, captures.add(Captures.of(capture, val))));
128
55
183
<methods>public non-sealed void <init>() ,public abstract Match<T> accept(java.lang.Object, io.crate.planner.optimizer.matcher.Captures, UnaryOperator<io.crate.planner.operators.LogicalPlan>) ,public Match<T> accept(java.lang.Object, io.crate.planner.optimizer.matcher.Captures) ,public Pattern<T> capturedAs(Capture<T>)...
crate_crate
crate/server/src/main/java/io/crate/planner/optimizer/matcher/WithPropertyPattern.java
WithPropertyPattern
accept
class WithPropertyPattern<T> extends Pattern<T> { private final Pattern<T> pattern; private final Predicate<? super T> propertyPredicate; WithPropertyPattern(Pattern<T> pattern, Predicate<? super T> propertyPredicate) { this.pattern = pattern; this.propertyPredicate = propertyPredicate; ...
Match<T> match = pattern.accept(object, captures, resolvePlan); return match.flatMap(matchedValue -> { if (propertyPredicate.test(matchedValue)) { return match; } else { return Match.empty(); } });
138
74
212
<methods>public non-sealed void <init>() ,public abstract Match<T> accept(java.lang.Object, io.crate.planner.optimizer.matcher.Captures, UnaryOperator<io.crate.planner.operators.LogicalPlan>) ,public Match<T> accept(java.lang.Object, io.crate.planner.optimizer.matcher.Captures) ,public Pattern<T> capturedAs(Capture<T>)...
crate_crate
crate/server/src/main/java/io/crate/planner/optimizer/rule/MoveFilterBeneathJoin.java
MoveFilterBeneathJoin
apply
class MoveFilterBeneathJoin implements Rule<Filter> { private final Capture<AbstractJoinPlan> joinCapture; private final Pattern<Filter> pattern; private static final Set<JoinType> SUPPORTED_JOIN_TYPES = EnumSet.of(INNER, LEFT, RIGHT, CROSS); public MoveFilterBeneathJoin() { this.joinCapture =...
var join = captures.get(joinCapture); var query = filter.query(); if (!WhereClause.canMatch(query)) { return join.replaceSources(List.of( getNewSource(query, join.lhs()), getNewSource(query, join.rhs()) )); } var splitQueri...
323
854
1,177
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/optimizer/rule/MoveFilterBeneathUnion.java
MoveFilterBeneathUnion
createNewFilter
class MoveFilterBeneathUnion implements Rule<Filter> { private final Capture<Union> unionCapture; private final Pattern<Filter> pattern; public MoveFilterBeneathUnion() { this.unionCapture = new Capture<>(); this.pattern = typeOf(Filter.class) .with(source(), typeOf(Union.class...
Symbol newQuery = FieldReplacer.replaceFields(filter.query(), f -> { int idx = filter.source().outputs().indexOf(f); if (idx < 0) { throw new IllegalArgumentException( "Field used in filter must be present in its source outputs." + ...
313
120
433
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/optimizer/rule/MoveOrderBeneathNestedLoop.java
MoveOrderBeneathNestedLoop
apply
class MoveOrderBeneathNestedLoop implements Rule<Order> { private final Capture<NestedLoopJoin> nlCapture; private final Pattern<Order> pattern; public MoveOrderBeneathNestedLoop() { this.nlCapture = new Capture<>(); this.pattern = typeOf(Order.class) .with(source(), ...
NestedLoopJoin nestedLoop = captures.get(nlCapture); Set<RelationName> relationsInOrderBy = Collections.newSetFromMap(new IdentityHashMap<>()); Consumer<ScopedSymbol> gatherRelationsFromField = f -> relationsInOrderBy.add(f.relation()); Consumer<Reference> gatherRelationsFro...
239
376
615
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/optimizer/rule/MoveOrderBeneathRename.java
MoveOrderBeneathRename
apply
class MoveOrderBeneathRename implements Rule<Order> { private final Capture<Rename> renameCapture; private final Pattern<Order> pattern; public MoveOrderBeneathRename() { this.renameCapture = new Capture<>(); this.pattern = typeOf(Order.class) .with(source(), typeOf(Rename.clas...
Rename rename = captures.get(renameCapture); Function<? super Symbol, ? extends Symbol> mapField = FieldReplacer.bind(rename::resolveField); OrderBy mappedOrderBy = plan.orderBy().map(mapField); if (rename.source().outputs().containsAll(mappedOrderBy.orderBySymbols())) { Ord...
209
139
348
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/optimizer/rule/OptimizeCollectWhereClauseAccess.java
OptimizeCollectWhereClauseAccess
apply
class OptimizeCollectWhereClauseAccess implements Rule<Collect> { private final Pattern<Collect> pattern; public OptimizeCollectWhereClauseAccess() { this.pattern = typeOf(Collect.class) .with(collect -> collect.relation() instanceof DocTableRelation ...
var relation = (DocTableRelation) collect.relation(); var normalizer = new EvaluatingNormalizer(nodeCtx, RowGranularity.CLUSTER, null, relation); WhereClause where = collect.where(); var detailedQuery = WhereClauseOptimizer.optimize( normalizer, where.queryOrFall...
212
254
466
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/optimizer/rule/ReorderNestedLoopJoin.java
ReorderNestedLoopJoin
apply
class ReorderNestedLoopJoin implements Rule<NestedLoopJoin> { private final Pattern<NestedLoopJoin> pattern = typeOf(NestedLoopJoin.class) .with(j -> j.orderByWasPushedDown() == false && j.joinType().supportsInversion() == true); @Override public Pattern<NestedLoopJoin> pattern(...
// We move the smaller table to the right side since benchmarking // revealed that this improves performance in most cases. var lhStats = planStats.get(nestedLoop.lhs()); var rhStats = planStats.get(nestedLoop.rhs()); boolean expectedRowsAvailable = lhStats.numDocs() != -1 && rh...
184
279
463
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/optimizer/rule/RewriteGroupByKeysLimitToLimitDistinct.java
RewriteGroupByKeysLimitToLimitDistinct
eagerTerminateIsLikely
class RewriteGroupByKeysLimitToLimitDistinct implements Rule<Limit> { private final Pattern<Limit> pattern; private final Capture<GroupHashAggregate> groupCapture; public RewriteGroupByKeysLimitToLimitDistinct() { this.groupCapture = new Capture<>(); this.pattern = typeOf(Limit.class) ...
if (groupAggregate.outputs().size() > 1 || !groupAggregate.outputs().get(0).valueType().equals(DataTypes.STRING)) { // `GroupByOptimizedIterator` can only be used for single text columns. // If that is not the case we can always use LimitDistinct even if a eagerTerminate isn't likely ...
403
1,005
1,408
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/optimizer/symbol/rule/MoveArrayLengthOnReferenceCastToLiteralCastInsideOperators.java
MoveArrayLengthOnReferenceCastToLiteralCastInsideOperators
apply
class MoveArrayLengthOnReferenceCastToLiteralCastInsideOperators implements Rule<Function> { private final Capture<Function> castCapture; private final Pattern<Function> pattern; private final FunctionSymbolResolver functionResolver; public MoveArrayLengthOnReferenceCastToLiteralCastInsideOperators(Fu...
var literalOrParam = operator.arguments().get(1); var castFunction = captures.get(castCapture); var function = castFunction.arguments().get(0); DataType<?> targetType = function.valueType(); return functionResolver.apply( operator.name(), List.of(functio...
396
96
492
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/optimizer/symbol/rule/SwapCastsInLikeOperators.java
SwapCastsInLikeOperators
apply
class SwapCastsInLikeOperators implements Rule<Function> { private final Set<String> LIKE_OPERATORS = Set.of(LikeOperators.OP_LIKE, LikeOperators.OP_ILIKE); private final Capture<Function> castCapture; private final Pattern<Function> pattern; public SwapCastsInLikeOperators(FunctionSymbolResolver fun...
var literalOrParam = likeFunction.arguments().get(1); var castFunction = captures.get(castCapture); var reference = castFunction.arguments().get(0); CastMode castMode = castFunction.castMode(); assert castMode != null : "Pattern matched, function must be a cast"; Symbol ...
330
214
544
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/statement/DeletePlanner.java
DeletePlanner
planDelete
class DeletePlanner { public static Plan planDelete(AnalyzedDeleteStatement delete, SubqueryPlanner subqueryPlanner, PlannerContext context) { Plan plan = planDelete(delete, context); return MultiPhasePlan.createIfNeeded(plan, subq...
DocTableRelation tableRel = delete.relation(); DocTableInfo table = tableRel.tableInfo(); EvaluatingNormalizer normalizer = EvaluatingNormalizer.functionOnlyNormalizer(context.nodeContext()); WhereClauseOptimizer.DetailedQuery detailedQuery = WhereClauseOptimizer.optimize( n...
1,142
361
1,503
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/statement/SetSessionAuthorizationPlan.java
SetSessionAuthorizationPlan
executeOrFail
class SetSessionAuthorizationPlan implements Plan { private final AnalyzedSetSessionAuthorizationStatement setSessionAuthorization; private final Roles roles; public SetSessionAuthorizationPlan(AnalyzedSetSessionAuthorizationStatement setSessionAuthorization, Roles r...
var sessionSettings = plannerContext.transactionContext().sessionSettings(); String userName = setSessionAuthorization.user(); Role user; if (userName != null) { user = roles.getUser(userName); } else { user = sessionSettings.authenticatedUser(); ...
184
112
296
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/planner/statement/SetSessionPlan.java
SetSessionPlan
executeOrFail
class SetSessionPlan implements Plan { private static final Logger LOGGER = LogManager.getLogger(SetSessionPlan.class); private final List<Assignment<Symbol>> settings; private final SessionSettingRegistry sessionSettingRegistry; public SetSessionPlan(List<Assignment<Symbol>> settings, SessionSettin...
Function<? super Symbol, Object> eval = x -> SymbolEvaluator.evaluate( plannerContext.transactionContext(), plannerContext.nodeContext(), x, params, subQueryResults ); var sessionSettings = plannerContext.transactionContext().session...
312
225
537
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/profile/ProfilingContext.java
ProfilingContext
resultAsMap
class ProfilingContext { private static final double NS_TO_MS_FACTOR = 1_000_000.0d; private final HashMap<String, Double> durationInMSByTimer; private final List<QueryProfiler> profilers; public ProfilingContext(List<QueryProfiler> profilers) { this.profilers = profilers; this.duratio...
HashMap<String, Object> queryTimingsBuilder = new HashMap<>(); queryTimingsBuilder.put("QueryName", profileResult.getQueryName()); queryTimingsBuilder.put("QueryDescription", profileResult.getLuceneDescription()); queryTimingsBuilder.put("Time", profileResult.getTime() / NS_TO_MS_FACTOR...
459
263
722
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/protocols/SSL.java
SSL
extractCN
class SSL { /** * Extract the common name from the subjectDN of a X509 Certificate */ @Nullable public static String extractCN(Certificate certificate) { if (certificate instanceof X509Certificate) { return extractCN(((X509Certificate) certificate).getSubjectX500Principal().ge...
/* * Get commonName using LdapName API * The DN of X509 certificates are in rfc2253 format. Ldap uses the same format. * * Doesn't use X500Name because it's internal API */ try { LdapName ldapName = new LdapName(subjectDN); for (Rdn r...
205
207
412
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/protocols/http/MainAndStaticFileHandler.java
MainAndStaticFileHandler
writeResponse
class MainAndStaticFileHandler extends SimpleChannelInboundHandler<FullHttpRequest> { private final Path sitePath; private final NodeClient client; private final Netty4CorsConfig corsConfig; private final String nodeName; public MainAndStaticFileHandler(String nodeName, Path home, NodeClient clien...
Netty4CorsHandler.setCorsResponseHeaders(req, resp, corsConfig); ChannelPromise promise = ctx.newPromise(); if (isCloseConnection(req)) { promise.addListener(ChannelFutureListener.CLOSE); } else { Headers.setKeepAlive(req.protocolVersion(), resp); } ...
1,325
103
1,428
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/protocols/postgres/ConnectionProperties.java
ConnectionProperties
clientCert
class ConnectionProperties { private static final Logger LOGGER = LogManager.getLogger(ConnectionProperties.class); private final InetAddress address; private final Protocol protocol; private final boolean hasSSL; @Nullable private final SSLSession sslSession; public ConnectionProperties...
// This logic isn't in the constructor to prevent logging in case of SSL without (expected) client-certificate auth if (sslSession != null) { try { return sslSession.getPeerCertificates()[0]; } catch (ArrayIndexOutOfBoundsException | SSLPeerUnverifiedException e)...
214
108
322
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/protocols/postgres/ResultSetReceiver.java
ResultSetReceiver
batchFinished
class ResultSetReceiver extends BaseResultReceiver { private final String query; private final DelayableWriteChannel channel; private final List<PGType<?>> columnTypes; private final TransactionState transactionState; private final AccessControl accessControl; private final Channel directChanne...
ChannelFuture sendPortalSuspended = Messages.sendPortalSuspended(directChannel); channel.writePendingMessages(delayedWrites); channel.flush(); // Trigger the completion future but by-pass `sendCompleteComplete` // This resultReceiver shouldn't be used anymore. The next `execute...
541
118
659
<methods>public non-sealed void <init>() ,public void allFinished() ,public void batchFinished() ,public CompletableFuture<java.lang.Void> completionFuture() ,public void fail(java.lang.Throwable) ,public void setNextRow(io.crate.data.Row) <variables>private CompletableFuture<java.lang.Void> completionFuture
crate_crate
crate/server/src/main/java/io/crate/protocols/postgres/RetryOnFailureResultReceiver.java
RetryOnFailureResultReceiver
fail
class RetryOnFailureResultReceiver<T> implements ResultReceiver<T> { private static final Logger LOGGER = LogManager.getLogger(RetryOnFailureResultReceiver.class); private final ClusterService clusterService; private final ClusterState initialState; private final Predicate<String> hasIndex; privat...
final Throwable error = SQLExceptions.unwrap(wrappedError); if (attempt <= Constants.MAX_SHARD_MISSING_RETRIES && (SQLExceptions.isShardFailure(error) || error instanceof ConnectTransportException || indexWasTemporaryUnavailable(error))) { if (clusterService.state().blocks().ha...
606
275
881
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/protocols/postgres/types/BooleanType.java
BooleanType
writeAsBinary
class BooleanType extends PGType<Boolean> { public static final BooleanType INSTANCE = new BooleanType(); static final int OID = 16; private static final int TYPE_LEN = 1; private static final int TYPE_MOD = -1; private static final byte[] TEXT_TRUE = new byte[]{'t'}; private static final byt...
byte byteValue = (byte) (value ? 1 : 0); buffer.writeInt(TYPE_LEN); buffer.writeByte(byteValue); return INT32_BYTE_SIZE + TYPE_LEN;
573
60
633
<methods>public int oid() ,public abstract java.lang.Boolean readBinaryValue(ByteBuf, int) ,public java.lang.Boolean readTextValue(ByteBuf, int) ,public abstract int typArray() ,public java.lang.String typDelim() ,public int typElem() ,public io.crate.types.Regproc typInput() ,public java.lang.String typName() ,public ...
crate_crate
crate/server/src/main/java/io/crate/protocols/postgres/types/IntegerType.java
IntegerType
readBinaryValue
class IntegerType extends PGType<Integer> { static final int OID = 23; private static final int TYPE_LEN = 4; private static final int TYPE_MOD = -1; public static final IntegerType INSTANCE = new IntegerType(); private IntegerType() { super(OID, TYPE_LEN, TYPE_MOD, "int4"); } @...
assert valueLength == TYPE_LEN : "length should be " + TYPE_LEN + " because int is int32. Actual length: " + valueLength; return buffer.readInt();
368
52
420
<methods>public int oid() ,public abstract java.lang.Integer readBinaryValue(ByteBuf, int) ,public java.lang.Integer readTextValue(ByteBuf, int) ,public abstract int typArray() ,public java.lang.String typDelim() ,public int typElem() ,public io.crate.types.Regproc typInput() ,public java.lang.String typName() ,public ...
crate_crate
crate/server/src/main/java/io/crate/protocols/postgres/types/JsonType.java
JsonType
encodeAsUTF8Text
class JsonType extends PGType<Object> { public static final JsonType INSTANCE = new JsonType(); static final int OID = 114; private static final int TYPE_LEN = -1; private static final int TYPE_MOD = -1; private JsonType() { super(OID, TYPE_LEN, TYPE_MOD, "json"); } @Override ...
if (value instanceof String str) { return str.getBytes(StandardCharsets.UTF_8); } try { XContentBuilder builder = JsonXContent.builder(); if (value instanceof List<?> values) { builder.startArray(); for (Object o : values) { ...
555
159
714
<methods>public int oid() ,public abstract java.lang.Object readBinaryValue(ByteBuf, int) ,public java.lang.Object readTextValue(ByteBuf, int) ,public abstract int typArray() ,public java.lang.String typDelim() ,public int typElem() ,public io.crate.types.Regproc typInput() ,public java.lang.String typName() ,public io...
crate_crate
crate/server/src/main/java/io/crate/protocols/postgres/types/OidType.java
OidType
readBinaryValue
class OidType extends PGType<Integer> { public static final OidType INSTANCE = new OidType(); static final int OID = 26; private static final int TYPE_LEN = 4; private static final int TYPE_MOD = -1; OidType() { super(OID, TYPE_LEN, TYPE_MOD, "oid"); } @Override public int t...
assert valueLength == TYPE_LEN : "length should be " + TYPE_LEN + " because oid is int32. Actual length: " + valueLength; return buffer.readInt();
366
53
419
<methods>public int oid() ,public abstract java.lang.Integer readBinaryValue(ByteBuf, int) ,public java.lang.Integer readTextValue(ByteBuf, int) ,public abstract int typArray() ,public java.lang.String typDelim() ,public int typElem() ,public io.crate.types.Regproc typInput() ,public java.lang.String typName() ,public ...
crate_crate
crate/server/src/main/java/io/crate/protocols/postgres/types/PGFloatVectorType.java
PGFloatVectorType
writeAsBinary
class PGFloatVectorType extends PGType<float[]> { public static final PGFloatVectorType INSTANCE = new PGFloatVectorType(); PGFloatVectorType() { super(PGArray.FLOAT4_ARRAY.oid(), -1, -1, PGArray.FLOAT4_ARRAY.typName()); } @Override public int typArray() { return 0; } @O...
int arrayLength = value.length; final int lenIndex = buffer.writerIndex(); buffer.writeInt(0); buffer.writeInt(1); // one dimension buffer.writeInt(0); // flags bit 0: 0=no-nulls, 1=has-nulls buffer.writeInt(typElem()); buffer.writeInt(arrayLength); // upper bo...
854
184
1,038
<methods>public int oid() ,public abstract float[] readBinaryValue(ByteBuf, int) ,public float[] readTextValue(ByteBuf, int) ,public abstract int typArray() ,public java.lang.String typDelim() ,public int typElem() ,public io.crate.types.Regproc typInput() ,public java.lang.String typName() ,public io.crate.types.Regpr...
crate_crate
crate/server/src/main/java/io/crate/protocols/postgres/types/RecordType.java
RecordType
encodeAsUTF8Text
class RecordType extends PGType<Row> { static final int OID = 2249; static final String NAME = "record"; static final RecordType EMPTY_RECORD = new RecordType(List.of()); private final List<PGType<?>> fieldTypes; RecordType(List<PGType<?>> fieldTypes) { super(OID, -1, -1, NAME); ...
ByteArrayList bytes = new ByteArrayList(); // See PostgreSQL src/backend/utils/adt/rowtypes.c record_out(PG_FUNCTION_ARGS) bytes.add((byte) '('); for (int i = 0; i < record.numColumns(); i++) { PGType fieldType = fieldTypes.get(i); var value = record.get(i); ...
641
342
983
<methods>public int oid() ,public abstract io.crate.data.Row readBinaryValue(ByteBuf, int) ,public io.crate.data.Row readTextValue(ByteBuf, int) ,public abstract int typArray() ,public java.lang.String typDelim() ,public int typElem() ,public io.crate.types.Regproc typInput() ,public java.lang.String typName() ,public ...
crate_crate
crate/server/src/main/java/io/crate/protocols/postgres/types/RegclassType.java
RegclassType
decodeUTF8Text
class RegclassType extends PGType<Regclass> { static final int OID = 2205; private static final int TYPE_LEN = 4; private static final int TYPE_MOD = -1; public static final RegclassType INSTANCE = new RegclassType(); private RegclassType() { super(OID, TYPE_LEN, TYPE_MOD, "regclass"); ...
String oidStr = new String(bytes, StandardCharsets.UTF_8); try { int oid = Integer.parseInt(oidStr); return new Regclass(oid, oidStr); } catch (NumberFormatException e) { var indexParts = new IndexParts(oidStr); return Regclass.fromRelationName(in...
387
103
490
<methods>public int oid() ,public abstract io.crate.types.Regclass readBinaryValue(ByteBuf, int) ,public io.crate.types.Regclass readTextValue(ByteBuf, int) ,public abstract int typArray() ,public java.lang.String typDelim() ,public int typElem() ,public io.crate.types.Regproc typInput() ,public java.lang.String typNam...
crate_crate
crate/server/src/main/java/io/crate/protocols/postgres/types/TimeTZType.java
TimeTZType
readBinaryValue
class TimeTZType extends PGType<TimeTZ> { public static final PGType<TimeTZ> INSTANCE = new TimeTZType(); private static final int OID = 1266; private static final String OID_TYPE_NAME = "timetz"; private static final int TYPE_MOD = -1; TimeTZType() { super(OID, TYPE_SIZE, TYPE_MOD, OID_T...
assert valueLength == TYPE_SIZE : String.format( Locale.ENGLISH, "valueLength must be %d because timetz is a 12 byte structure. Actual length: %d", TYPE_SIZE, valueLength); return new TimeTZ(buffer.readLong(), buffer.readInt());
483
81
564
<methods>public int oid() ,public abstract io.crate.types.TimeTZ readBinaryValue(ByteBuf, int) ,public io.crate.types.TimeTZ readTextValue(ByteBuf, int) ,public abstract int typArray() ,public java.lang.String typDelim() ,public int typElem() ,public io.crate.types.Regproc typInput() ,public java.lang.String typName() ...
crate_crate
crate/server/src/main/java/io/crate/protocols/postgres/types/TimestampZType.java
TimestampZType
encodeAsUTF8Text
class TimestampZType extends BaseTimestampType { public static final PGType INSTANCE = new TimestampZType(); private static final int OID = 1184; private static final String NAME = "timestamptz"; // For Golang if date is AD (after Christ), era abbreviation is not parsed. private static final Date...
long msecs = (long) value; if (msecs >= FIRST_MSEC_AFTER_CHRIST) { return ISO_FORMATTER.print(msecs).getBytes(StandardCharsets.UTF_8); } else { return ISO_FORMATTER_WITH_ERA.print(msecs).getBytes(StandardCharsets.UTF_8); }
1,048
101
1,149
<methods>public java.lang.Object readBinaryValue(ByteBuf, int) ,public java.lang.String type() ,public java.lang.String typeCategory() ,public int writeAsBinary(ByteBuf, java.lang.Object) <variables>private static final long EPOCH_DIFF_IN_MS,protected static final long FIRST_MSEC_AFTER_CHRIST,protected static final int...
crate_crate
crate/server/src/main/java/io/crate/protocols/postgres/types/VarCharType.java
VarCharType
readBinaryValue
class VarCharType extends PGType<Object> { static final int OID = 1043; private static final int ARRAY_OID = 1015; private static final int TYPE_LEN = -1; private static final int TYPE_MOD = -1; public static final VarCharType INSTANCE = new VarCharType(ARRAY_OID); private final int typArray;...
int readerIndex = buffer.readerIndex(); buffer.readerIndex(readerIndex + valueLength); return buffer.toString(readerIndex, valueLength, StandardCharsets.UTF_8);
748
48
796
<methods>public int oid() ,public abstract java.lang.Object readBinaryValue(ByteBuf, int) ,public java.lang.Object readTextValue(ByteBuf, int) ,public abstract int typArray() ,public java.lang.String typDelim() ,public int typElem() ,public io.crate.types.Regproc typInput() ,public java.lang.String typName() ,public io...
crate_crate
crate/server/src/main/java/io/crate/replication/logical/MetadataTracker.java
AckMetadataUpdateRequest
updateIndexMetadata
class AckMetadataUpdateRequest extends AcknowledgedRequest<AckMetadataUpdateRequest> { } @VisibleForTesting static ClusterState updateIndexMetadata(String subscriptionName, Subscription subscription, ClusterState subscr...
// Check for all the subscribed tables if the index metadata and settings changed and if so apply // the changes from the publisher cluster state to the subscriber cluster state var updatedMetadataBuilder = Metadata.builder(subscriberClusterState.metadata()); var updateClusterState = fa...
91
536
627
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/replication/logical/action/GetFileChunkAction.java
TransportAction
shardOperation
class TransportAction extends TransportSingleShardAction<Request, Response> { private final IndicesService indicesService; private final PublisherRestoreService publisherRestoreService; @Inject public TransportAction(ThreadPool threadPool, ClusterService ...
var indexShard = indicesService.indexServiceSafe(shardId.getIndex()).getShard(shardId.id()); var store = indexShard.store(); var buffer = new byte[request.length()]; var bytesRead = 0; store.incRef(); var fileMetadata = request.storeFileMetadata(...
339
222
561
<methods>public void <init>(java.lang.String) ,public boolean equals(java.lang.Object) ,public Reader<io.crate.replication.logical.action.GetFileChunkAction.Response> getResponseReader() ,public int hashCode() ,public java.lang.String name() ,public org.elasticsearch.transport.TransportRequestOptions transportOptions(o...
crate_crate
crate/server/src/main/java/io/crate/replication/logical/action/PublicationsStateAction.java
TransportAction
masterOperation
class TransportAction extends TransportMasterNodeReadAction<Request, Response> { private final Roles roles; @Inject public TransportAction(TransportService transportService, ClusterService clusterService, ThreadPool threadPool, ...
// Ensure subscribing user was not dropped after remote connection was established on another side. // Subscribing users must be checked on a publisher side as they belong to the publishing cluster. Role subscriber = roles.findUser(request.subscribingUserName()); if (sub...
293
420
713
<methods>public void <init>(java.lang.String) ,public boolean equals(java.lang.Object) ,public Reader<io.crate.replication.logical.action.PublicationsStateAction.Response> getResponseReader() ,public int hashCode() ,public java.lang.String name() ,public org.elasticsearch.transport.TransportRequestOptions transportOpti...
crate_crate
crate/server/src/main/java/io/crate/replication/logical/action/ReleasePublisherResourcesAction.java
TransportAction
shardOperation
class TransportAction extends TransportSingleShardAction<Request, AcknowledgedResponse> { private static final Logger LOGGER = LogManager.getLogger(TransportAction.class); private final PublisherRestoreService publisherRestoreService; @Inject public TransportAction(ThreadPool threadPo...
if (LOGGER.isDebugEnabled()) { LOGGER.debug("Releasing resources for {} with restore-id as {}", shardId, request.restoreUUID()); } publisherRestoreService.removeRestoreContext(request.restoreUUID()); return new AcknowledgedResponse(true);
361
78
439
<methods>public void <init>(java.lang.String) ,public boolean equals(java.lang.Object) ,public Reader<org.elasticsearch.action.support.master.AcknowledgedResponse> getResponseReader() ,public int hashCode() ,public java.lang.String name() ,public org.elasticsearch.transport.TransportRequestOptions transportOptions(org....
crate_crate
crate/server/src/main/java/io/crate/replication/logical/action/RestoreShardRequest.java
RestoreShardRequest
toString
class RestoreShardRequest<T extends SingleShardRequest<T>> extends SingleShardRequest<T> implements RemoteClusterAwareRequest { private final String restoreUUID; private final DiscoveryNode node; private final ShardId shardId; private final String subscriberClusterName; public RestoreShardRequ...
return "RestoreShardRequest{" + "restoreUUID='" + restoreUUID + '\'' + ", node=" + node + ", shardId=" + shardId + ", subscriberClusterName='" + subscriberClusterName + '\'' + ", index='" + index + '\'' + '}';
445
86
531
<methods>public void <init>() ,public void <init>(org.elasticsearch.common.io.stream.StreamInput) throws java.io.IOException,public java.lang.String index() ,public final T index(java.lang.String) ,public java.lang.String[] indices() ,public org.elasticsearch.action.support.IndicesOptions indicesOptions() ,public void ...
crate_crate
crate/server/src/main/java/io/crate/replication/logical/action/TransportCreateSubscriptionAction.java
TransportCreateSubscriptionAction
checkVersionCompatibility
class TransportCreateSubscriptionAction extends TransportMasterNodeAction<CreateSubscriptionRequest, AcknowledgedResponse> { public static final String ACTION_NAME = "internal:crate:replication/logical/subscription/create"; private final String source; private final LogicalReplicationService logicalReplic...
Version publishedTableVersion = settings.getAsVersion(IndexMetadata.SETTING_VERSION_CREATED, null); assert publishedTableVersion != null : "All published tables must have version created setting"; if (subscriberMinNodeVersion.beforeMajorMinor(publishedTableVersion)) { throw new Ille...
1,418
166
1,584
<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/replication/logical/action/TransportDropPublicationAction.java
TransportDropPublicationAction
execute
class TransportDropPublicationAction extends AbstractDDLTransportAction<DropPublicationRequest, AcknowledgedResponse> { public static final String ACTION_NAME = "internal:crate:replication/logical/publication/drop"; @Inject public TransportDropPublicationAction(TransportService transportService, ...
Metadata currentMetadata = currentState.metadata(); Metadata.Builder mdBuilder = Metadata.builder(currentMetadata); PublicationsMetadata oldMetadata = (PublicationsMetadata) mdBuilder.getCustom(PublicationsMetadata.TYPE); if (oldMetadata == null && reque...
303
256
559
<methods>public void <init>(java.lang.String, org.elasticsearch.transport.TransportService, org.elasticsearch.cluster.service.ClusterService, org.elasticsearch.threadpool.ThreadPool, Reader<io.crate.replication.logical.action.DropPublicationRequest>, Reader<org.elasticsearch.action.support.master.AcknowledgedResponse>,...
crate_crate
crate/server/src/main/java/io/crate/replication/logical/analyze/LogicalReplicationAnalyzer.java
LogicalReplicationAnalyzer
analyze
class LogicalReplicationAnalyzer { private final Schemas schemas; private final LogicalReplicationService logicalReplicationService; private final NodeContext nodeCtx; public LogicalReplicationAnalyzer(Schemas schemas, LogicalReplicationService logicalReplicationS...
var publication = logicalReplicationService.publications().get(alterPublication.name()); if (publication == null) { throw new PublicationUnknownException(alterPublication.name()); } if (publication.owner().equals(sessionSettings.sessionUser().name()) == false && ...
1,321
297
1,618
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/replication/logical/metadata/pgcatalog/PgSubscriptionRelTable.java
PgSubscriptionRelTable
create
class PgSubscriptionRelTable { public static final RelationName IDENT = new RelationName(PgCatalogSchemaInfo.NAME, "pg_subscription_rel"); public static SystemTable<PgSubscriptionRelTable.PgSubscriptionRelRow> create() {<FILL_FUNCTION_BODY>} public static Iterable<PgSubscriptionRelTable.PgSubscriptionRel...
return SystemTable.<PgSubscriptionRelTable.PgSubscriptionRelRow>builder(IDENT) .add("srsubid", INTEGER, PgSubscriptionRelRow::subOid) .add("srrelid", REGCLASS, PgSubscriptionRelRow::relOid) .add("srsubstate", STRING, PgSubscriptionRelRow::state) .add("srsubstate_...
349
178
527
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/replication/logical/metadata/pgcatalog/PgSubscriptionTable.java
PgSubscriptionTable
create
class PgSubscriptionTable { public static final RelationName IDENT = new RelationName(PgCatalogSchemaInfo.NAME, "pg_subscription"); public static SystemTable<SubscriptionRow> create() {<FILL_FUNCTION_BODY>} public record SubscriptionRow(String name, Subscription subscription) { } }
return SystemTable.<SubscriptionRow>builder(IDENT) .add("oid", INTEGER, r -> OidHash.subscriptionOid(r.name, r.subscription)) .add("subdbid", INTEGER, ignored -> 0) .add("subname", STRING, r -> r.name) .add("subowner", STRING, r -> r.subscription.owner()) ...
89
256
345
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/replication/logical/repository/RemoteClusterMultiChunkTransfer.java
RemoteClusterMultiChunkTransfer
executeChunkRequest
class RemoteClusterMultiChunkTransfer extends MultiChunkTransfer<StoreFileMetadata, RemoteClusterRepositoryFileChunk> { private static final String RESTORE_SHARD_TEMP_FILE_PREFIX = "CLUSTER_REPO_TEMP_"; private static final Logger LOGGER = LogManager.getLogger(RemoteClusterMultiChunkTransfer.class); priva...
var getFileChunkRequest = new GetFileChunkAction.Request( restoreUUID, remoteNode, remoteShardId, localClusterName, request.storeFileMetadata(), request.offset(), request.length() ); var fileChunkResponse = clie...
748
360
1,108
<methods>public final void start() <variables>private org.elasticsearch.index.store.StoreFileMetadata currentSource,private final non-sealed ActionListener<java.lang.Void> listener,private final non-sealed Logger logger,private final non-sealed int maxConcurrentChunks,private final non-sealed AsyncIOProcessor<FileChunk...
crate_crate
crate/server/src/main/java/io/crate/replication/logical/seqno/RetentionLeaseHelper.java
RetentionLeaseHelper
addRetentionLease
class RetentionLeaseHelper { private static final Logger LOGGER = LogManager.getLogger(RetentionLeaseHelper.class); private static String retentionLeaseSource(String subscriberClusterName) { return "logical_replication:" + subscriberClusterName; } private static String retentionLeaseIdForShar...
var retentionLeaseId = retentionLeaseIdForShard(subscriberClusterName, shardId); var request = new RetentionLeaseActions.AddOrRenewRequest( shardId, retentionLeaseId, seqNo, retentionLeaseSource(subscriberClusterName) ); client.execute(Ret...
651
310
961
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/rest/action/RestRowCountReceiver.java
RestRowCountReceiver
finishBuilder
class RestRowCountReceiver implements ResultReceiver<XContentBuilder> { private final long startTimeNs; private final boolean includeTypes; private final ResultToXContentBuilder builder; private final CompletableFuture<XContentBuilder> result = new CompletableFuture<>(); private long rowCount; ...
builder.cols(Collections.emptyList()); if (includeTypes) { builder.colTypes(Collections.emptyList()); } builder.startRows() .addRow(Row.EMPTY, 0) .finishRows() .rowCount(rowCount) .duration(startTimeNs); return builder....
356
93
449
<no_super_class>
crate_crate
crate/server/src/main/java/io/crate/role/AlterRoleRequest.java
AlterRoleRequest
writeTo
class AlterRoleRequest extends AcknowledgedRequest<AlterRoleRequest> { private final String roleName; private final SecureHash secureHash; @Nullable private final JwtProperties jwtProperties; private final boolean resetPassword; private final boolean resetJwtProperties; public AlterRol...
super.writeTo(out); out.writeString(roleName); out.writeOptionalWriteable(secureHash); if (out.getVersion().onOrAfter(Version.V_5_7_0)) { out.writeOptionalWriteable(jwtProperties); out.writeBoolean(resetPassword); out.writeBoolean(resetJwtProperties);...
488
96
584
<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.role.AlterRoleRequest timeout(java.lang.String) ,public final io.crate.role.AlterRoleRequest timeout(io.crate.common.unit.TimeValue) ,public fi...
crate_crate
crate/server/src/main/java/io/crate/role/PrivilegesRequest.java
PrivilegesRequest
writeTo
class PrivilegesRequest extends AcknowledgedRequest<PrivilegesRequest> { private final Collection<String> roleNames; private final Collection<Privilege> privileges; @Nullable private final GrantedRolesChange grantedRolesChange; PrivilegesRequest(Collection<String> roleNames, ...
super.writeTo(out); out.writeVInt(roleNames.size()); for (String roleName : roleNames) { out.writeString(roleName); } out.writeVInt(privileges.size()); for (Privilege privilege : privileges) { privilege.writeTo(out); } if (out.getV...
458
129
587
<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.role.PrivilegesRequest timeout(java.lang.String) ,public final io.crate.role.PrivilegesRequest timeout(io.crate.common.unit.TimeValue) ,public ...