You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ignite.apache.org by tl...@apache.org on 2021/11/09 12:20:32 UTC
[ignite-3] branch main updated: IGNITE-15776 Fix code style issue
for sql components (#427)
This is an automated email from the ASF dual-hosted git repository.
tledkov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/ignite-3.git
The following commit(s) were added to refs/heads/main by this push:
new d71b5e2 IGNITE-15776 Fix code style issue for sql components (#427)
d71b5e2 is described below
commit d71b5e2c2d5cc4788861a9ef84bd9cedaab21932
Author: Berkof <sa...@mail.ru>
AuthorDate: Tue Nov 9 19:20:24 2021 +0700
IGNITE-15776 Fix code style issue for sql components (#427)
---
.../query/calcite/ResultFieldMetadata.java | 21 +-
.../query/calcite/ResultSetMetadata.java | 2 +-
.../processors/query/calcite/SqlCursor.java | 4 +-
.../query/calcite/SqlQueryProcessor.java | 77 +-
.../processors/query/calcite/SqlQueryType.java | 2 +
.../internal/processors/query/calcite/Stubs.java | 5 +-
.../query/calcite/exec/AbstractIndexScan.java | 22 +-
.../query/calcite/exec/ArrayRowHandler.java | 6 -
.../calcite/exec/ClosableIteratorsHolder.java | 54 +-
.../query/calcite/exec/ExchangeService.java | 9 +-
.../query/calcite/exec/ExchangeServiceImpl.java | 29 +-
.../calcite/exec/ExecutionCancelledException.java | 3 +-
.../query/calcite/exec/ExecutionContext.java | 64 +-
.../query/calcite/exec/ExecutionService.java | 3 +-
.../query/calcite/exec/ExecutionServiceImpl.java | 519 +++++-------
.../query/calcite/exec/LogicalRelImplementor.java | 29 +-
.../query/calcite/exec/MailboxRegistry.java | 3 +-
.../query/calcite/exec/MailboxRegistryImpl.java | 41 +-
.../query/calcite/exec/PlannerHelper.java | 17 +-
.../query/calcite/exec/QueryTaskExecutor.java | 3 +-
.../query/calcite/exec/QueryTaskExecutorImpl.java | 23 +-
.../processors/query/calcite/exec/RowHandler.java | 34 +-
.../query/calcite/exec/RuntimeHashIndex.java | 24 +-
.../query/calcite/exec/RuntimeTreeIndex.java | 26 +-
.../query/calcite/exec/TableFunctionScan.java | 12 +-
.../query/calcite/exec/exp/ConverterUtils.java | 65 +-
.../query/calcite/exec/exp/ExpressionFactory.java | 3 -
.../calcite/exec/exp/ExpressionFactoryImpl.java | 123 +--
.../calcite/exec/exp/IgniteBuiltInMethod.java | 12 -
.../query/calcite/exec/exp/IgniteSqlFunctions.java | 15 +-
.../exec/exp/ReflectiveCallNotNullImplementor.java | 6 -
.../query/calcite/exec/exp/RexImpTable.java | 294 +------
.../query/calcite/exec/exp/RexToLixTranslator.java | 167 ++--
.../processors/query/calcite/exec/exp/Scalar.java | 6 +-
.../query/calcite/exec/exp/agg/Accumulator.java | 17 +-
.../calcite/exec/exp/agg/AccumulatorWrapper.java | 15 +-
.../query/calcite/exec/exp/agg/Accumulators.java | 273 +------
.../calcite/exec/exp/agg/AccumulatorsFactory.java | 93 +--
.../query/calcite/exec/exp/agg/AggregateType.java | 3 +-
.../query/calcite/exec/exp/agg/GroupKey.java | 39 +-
.../query/calcite/exec/rel/AbstractNode.java | 62 +-
.../query/calcite/exec/rel/AbstractSetOpNode.java | 84 +-
.../exec/rel/CorrelatedNestedLoopJoinNode.java | 99 +--
.../query/calcite/exec/rel/FilterNode.java | 28 +-
.../query/calcite/exec/rel/HashAggregateNode.java | 77 +-
.../processors/query/calcite/exec/rel/Inbox.java | 148 +---
.../query/calcite/exec/rel/IndexSpoolNode.java | 29 +-
.../query/calcite/exec/rel/IntersectNode.java | 9 -
.../processors/query/calcite/exec/rel/Mailbox.java | 9 +-
.../query/calcite/exec/rel/MergeJoinNode.java | 152 +---
.../query/calcite/exec/rel/MinusNode.java | 9 -
.../query/calcite/exec/rel/ModifyNode.java | 56 +-
.../query/calcite/exec/rel/NestedLoopJoinNode.java | 161 +---
.../processors/query/calcite/exec/rel/Node.java | 2 +
.../processors/query/calcite/exec/rel/Outbox.java | 75 +-
.../query/calcite/exec/rel/ProjectNode.java | 10 +-
.../query/calcite/exec/rel/RootNode.java | 45 +-
.../query/calcite/exec/rel/ScanNode.java | 19 +-
.../query/calcite/exec/rel/SingleNode.java | 8 +-
.../query/calcite/exec/rel/SortAggregateNode.java | 78 +-
.../query/calcite/exec/rel/SortNode.java | 9 +-
.../query/calcite/exec/rel/TableScanNode.java | 41 +-
.../query/calcite/exec/rel/TableSpoolNode.java | 15 +-
.../query/calcite/exec/rel/UnionAllNode.java | 16 +-
.../query/calcite/externalize/RelInputEx.java | 6 +-
.../query/calcite/externalize/RelJson.java | 177 +----
.../query/calcite/externalize/RelJsonReader.java | 57 +-
.../query/calcite/externalize/RelJsonWriter.java | 36 +-
.../query/calcite/message/ErrorMessage.java | 9 +-
.../message/ExecutionContextAwareMessage.java | 4 +-
.../query/calcite/message/InboxCloseMessage.java | 9 +-
.../query/calcite/message/MessageListener.java | 5 +-
.../query/calcite/message/MessageService.java | 3 +-
.../query/calcite/message/MessageServiceImpl.java | 24 +-
.../query/calcite/message/OutboxCloseMessage.java | 9 +-
.../message/QueryBatchAcknowledgeMessage.java | 7 +-
.../query/calcite/message/QueryBatchMessage.java | 11 +-
.../query/calcite/message/QueryStartRequest.java | 12 +-
.../query/calcite/message/QueryStartResponse.java | 9 +-
.../query/calcite/metadata/AffinityService.java | 3 +-
.../query/calcite/metadata/ColocationGroup.java | 55 +-
.../metadata/ColocationMappingException.java | 5 +-
.../calcite/metadata/FragmentDescription.java | 31 +-
.../query/calcite/metadata/FragmentMapping.java | 48 +-
.../calcite/metadata/FragmentMappingException.java | 15 +-
.../query/calcite/metadata/IgniteMdCollation.java | 153 ++--
.../calcite/metadata/IgniteMdCumulativeCost.java | 18 +-
.../calcite/metadata/IgniteMdDistinctRowCount.java | 3 +-
.../calcite/metadata/IgniteMdDistribution.java | 10 +-
.../calcite/metadata/IgniteMdFragmentMapping.java | 29 +-
.../metadata/IgniteMdNonCumulativeCost.java | 12 +-
.../metadata/IgniteMdPercentageOriginalRows.java | 20 +-
.../query/calcite/metadata/IgniteMdPredicates.java | 9 +-
.../query/calcite/metadata/IgniteMdRowCount.java | 10 +-
.../calcite/metadata/IgniteMdSelectivity.java | 18 +-
.../query/calcite/metadata/IgniteMetadata.java | 6 +-
.../query/calcite/metadata/MappingServiceImpl.java | 6 +-
.../calcite/metadata/NodeMappingException.java | 10 +-
.../query/calcite/metadata/RelMetadataQueryEx.java | 11 +-
.../query/calcite/metadata/RemoteException.java | 20 +-
.../query/calcite/metadata/cost/IgniteCost.java | 22 +-
.../calcite/prepare/AbstractMultiStepPlan.java | 48 +-
.../processors/query/calcite/prepare/CacheKey.java | 16 +-
.../processors/query/calcite/prepare/Cloner.java | 18 +-
.../processors/query/calcite/prepare/DdlPlan.java | 12 +-
.../query/calcite/prepare/ExecutionPlan.java | 8 +-
.../query/calcite/prepare/ExplainPlan.java | 9 +-
.../query/calcite/prepare/FieldsMetadata.java | 7 +-
.../query/calcite/prepare/FieldsMetadataImpl.java | 12 +-
.../processors/query/calcite/prepare/Fragment.java | 56 +-
.../query/calcite/prepare/FragmentPlan.java | 12 +-
.../query/calcite/prepare/FragmentSplitter.java | 39 +-
.../query/calcite/prepare/IdGenerator.java | 12 +-
.../query/calcite/prepare/IgnitePlanner.java | 85 +-
.../query/calcite/prepare/IgnitePrograms.java | 3 +-
.../query/calcite/prepare/IgniteRelShuttle.java | 3 +-
.../query/calcite/prepare/IgniteSqlValidator.java | 30 +-
.../query/calcite/prepare/MultiStepDmlPlan.java | 3 +-
.../query/calcite/prepare/MultiStepPlan.java | 15 +-
.../query/calcite/prepare/MultiStepQueryPlan.java | 3 +
.../query/calcite/prepare/PlannerHelper.java | 12 +-
.../query/calcite/prepare/PlannerPhase.java | 11 +-
.../query/calcite/prepare/PlanningContext.java | 116 +--
.../query/calcite/prepare/QueryPlan.java | 7 +-
.../query/calcite/prepare/QueryPlanCache.java | 6 +-
.../query/calcite/prepare/QueryPlanFactory.java | 5 +-
.../query/calcite/prepare/QueryTemplate.java | 24 +-
.../calcite/prepare/ResultFieldMetadataImpl.java | 24 +-
.../calcite/prepare/ResultSetMetadataInternal.java | 3 +-
.../processors/query/calcite/prepare/Splitter.java | 27 +-
.../query/calcite/prepare/ValidationResult.java | 20 +-
.../calcite/prepare/ddl/ColumnDefinition.java | 21 +-
.../calcite/prepare/ddl/CreateTableCommand.java | 56 +-
.../prepare/ddl/DdlSqlToCommandConverter.java | 33 +-
.../calcite/prepare/ddl/DropTableCommand.java | 12 +-
.../query/calcite/rel/AbstractIgniteJoin.java | 9 +-
.../query/calcite/rel/AbstractIgniteSpool.java | 3 +-
.../query/calcite/rel/AbstractIndexScan.java | 25 +-
.../query/calcite/rel/IgniteAggregate.java | 12 +-
.../query/calcite/rel/IgniteConvention.java | 6 -
.../rel/IgniteCorrelatedNestedLoopJoin.java | 6 +-
.../query/calcite/rel/IgniteExchange.java | 11 +-
.../processors/query/calcite/rel/IgniteFilter.java | 43 +-
.../query/calcite/rel/IgniteHashIndexSpool.java | 18 +-
.../query/calcite/rel/IgniteIndexScan.java | 25 +-
.../processors/query/calcite/rel/IgniteLimit.java | 67 +-
.../query/calcite/rel/IgniteMergeJoin.java | 100 +--
.../query/calcite/rel/IgniteNestedLoopJoin.java | 34 +-
.../query/calcite/rel/IgniteProject.java | 87 +-
.../query/calcite/rel/IgniteReceiver.java | 29 +-
.../processors/query/calcite/rel/IgniteRel.java | 8 +-
.../query/calcite/rel/IgniteRelVisitor.java | 54 +-
.../processors/query/calcite/rel/IgniteSender.java | 22 +-
.../processors/query/calcite/rel/IgniteSort.java | 35 +-
.../query/calcite/rel/IgniteSortedIndexSpool.java | 18 +-
.../query/calcite/rel/IgniteTableModify.java | 3 +-
.../query/calcite/rel/IgniteTableScan.java | 41 +-
.../query/calcite/rel/IgniteTableSpool.java | 6 +-
.../query/calcite/rel/IgniteTrimExchange.java | 15 +-
.../query/calcite/rel/IgniteUnionAll.java | 55 +-
.../processors/query/calcite/rel/IgniteValues.java | 17 +-
.../rel/ProjectableFilterableTableScan.java | 21 +-
.../query/calcite/rel/SourceAwareIgniteRel.java | 8 +-
.../calcite/rel/agg/IgniteHashAggregateBase.java | 3 +-
.../calcite/rel/agg/IgniteMapAggregateBase.java | 3 +-
.../calcite/rel/agg/IgniteMapHashAggregate.java | 12 +-
.../calcite/rel/agg/IgniteMapSortAggregate.java | 9 +-
.../calcite/rel/agg/IgniteReduceAggregateBase.java | 27 +-
.../calcite/rel/agg/IgniteReduceHashAggregate.java | 9 +-
.../calcite/rel/agg/IgniteReduceSortAggregate.java | 9 +-
.../calcite/rel/agg/IgniteSingleAggregateBase.java | 3 +-
.../calcite/rel/agg/IgniteSingleHashAggregate.java | 3 +-
.../calcite/rel/agg/IgniteSingleSortAggregate.java | 11 +-
.../calcite/rel/agg/IgniteSortAggregateBase.java | 3 +-
.../rel/logical/IgniteLogicalIndexScan.java | 13 +-
.../rel/logical/IgniteLogicalTableScan.java | 5 +-
.../query/calcite/rel/set/IgniteIntersect.java | 3 -
.../query/calcite/rel/set/IgniteMapIntersect.java | 6 +-
.../query/calcite/rel/set/IgniteMapMinus.java | 6 +-
.../query/calcite/rel/set/IgniteMinus.java | 3 +-
.../query/calcite/rel/set/IgniteMinusBase.java | 33 +-
.../calcite/rel/set/IgniteReduceIntersect.java | 22 +-
.../query/calcite/rel/set/IgniteReduceMinus.java | 22 +-
.../calcite/rel/set/IgniteSingleIntersect.java | 3 +-
.../query/calcite/rel/set/IgniteSingleMinus.java | 3 +-
.../calcite/rule/AbstractIgniteConverterRule.java | 9 +-
.../calcite/rule/CorrelateToNestedLoopRule.java | 18 +-
.../calcite/rule/CorrelatedNestedLoopJoinRule.java | 27 +-
.../query/calcite/rule/FilterConverterRule.java | 9 +-
.../rule/FilterSpoolMergeToHashIndexSpoolRule.java | 9 +-
.../FilterSpoolMergeToSortedIndexSpoolRule.java | 38 +-
.../calcite/rule/HashAggregateConverterRule.java | 24 +-
.../calcite/rule/LogicalScanConverterRule.java | 6 +-
.../query/calcite/rule/MergeJoinConverterRule.java | 3 -
.../query/calcite/rule/MinusConverterRule.java | 21 -
.../calcite/rule/NestedLoopJoinConverterRule.java | 3 -
.../query/calcite/rule/ProjectConverterRule.java | 9 +-
.../query/calcite/rule/SetOpConverterRule.java | 51 --
.../calcite/rule/SortAggregateConverterRule.java | 24 +-
.../query/calcite/rule/SortConverterRule.java | 8 +-
.../rule/TableFunctionScanConverterRule.java | 3 -
.../calcite/rule/TableModifyConverterRule.java | 6 +-
.../query/calcite/rule/UnionConverterRule.java | 12 +-
.../query/calcite/rule/ValuesConverterRule.java | 6 +-
.../calcite/rule/logical/ExposeIndexRule.java | 12 +-
.../calcite/rule/logical/FilterScanMergeRule.java | 3 -
.../calcite/rule/logical/LogicalOrToUnionRule.java | 34 +-
.../calcite/rule/logical/ProjectScanMergeRule.java | 6 +-
.../query/calcite/schema/ColumnDescriptor.java | 24 +-
.../query/calcite/schema/ColumnDescriptorImpl.java | 16 +-
.../query/calcite/schema/IgniteIndex.java | 22 +-
.../query/calcite/schema/IgniteSchema.java | 13 +-
.../query/calcite/schema/IgniteTable.java | 6 +-
.../query/calcite/schema/IgniteTableImpl.java | 64 +-
.../query/calcite/schema/SchemaHolder.java | 5 +-
.../query/calcite/schema/SchemaHolderImpl.java | 63 +-
.../query/calcite/schema/TableDescriptor.java | 5 +-
.../query/calcite/schema/TableDescriptorImpl.java | 33 +-
.../query/calcite/sql/IgniteSqlCreateTable.java | 23 +-
.../calcite/sql/IgniteSqlCreateTableOption.java | 37 +-
.../calcite/sql/fun/IgniteSqlOperatorTable.java | 6 -
.../query/calcite/trait/AffinityAdapter.java | 15 +-
.../processors/query/calcite/trait/AllNodes.java | 9 +-
.../query/calcite/trait/CorrelationTrait.java | 69 +-
.../query/calcite/trait/CorrelationTraitDef.java | 6 +-
.../query/calcite/trait/Destination.java | 4 +-
.../query/calcite/trait/DistributionFunction.java | 80 +-
.../query/calcite/trait/DistributionTrait.java | 93 ++-
.../query/calcite/trait/DistributionTraitDef.java | 9 +-
.../query/calcite/trait/IgniteDistribution.java | 2 +-
.../query/calcite/trait/IgniteDistributions.java | 38 +-
.../query/calcite/trait/Partitioned.java | 12 +-
.../processors/query/calcite/trait/RandomNode.java | 12 +-
.../processors/query/calcite/trait/RelFactory.java | 3 +-
.../query/calcite/trait/RewindabilityTrait.java | 21 +-
.../query/calcite/trait/RewindabilityTraitDef.java | 6 +-
.../processors/query/calcite/trait/TraitUtils.java | 284 ++++---
.../query/calcite/trait/TraitsAwareIgniteRel.java | 3 +-
.../query/calcite/type/IgniteTypeFactory.java | 12 +-
.../query/calcite/type/IgniteTypeSystem.java | 3 -
.../processors/query/calcite/util/Commons.java | 281 ++++---
.../query/calcite/util/FilteringIterator.java | 11 +-
.../processors/query/calcite/util/HintUtils.java | 23 +-
.../query/calcite/util/IgniteMethod.java | 25 +-
.../query/calcite/util/IgniteResource.java | 17 +-
.../query/calcite/util/IndexConditions.java | 36 +-
.../query/calcite/util/NodeLeaveHandler.java | 8 +
.../processors/query/calcite/util/Primitives.java | 34 +-
.../processors/query/calcite/util/RexUtils.java | 334 ++++----
.../query/calcite/util/TransformingIterator.java | 8 +
.../processors/query/calcite/util/TypeUtils.java | 143 ++--
.../query/calcite/StopCalciteModuleTest.java | 83 +-
.../query/calcite/exec/RuntimeTreeIndexTest.java | 27 +-
.../calcite/exec/rel/AbstractExecutionTest.java | 129 +--
.../exec/rel/AbstractSetOpExecutionTest.java | 24 +-
.../query/calcite/exec/rel/BaseAggregateTest.java | 221 +++---
.../query/calcite/exec/rel/ExecutionTest.java | 305 ++++----
.../exec/rel/HashAggregateExecutionTest.java | 37 +-
.../rel/HashAggregateSingleGroupExecutionTest.java | 173 ++--
.../exec/rel/HashIndexSpoolExecutionTest.java | 27 +-
.../calcite/exec/rel/MergeJoinExecutionTest.java | 24 +-
.../exec/rel/NestedLoopJoinExecutionTest.java | 24 +-
.../exec/rel/SortAggregateExecutionTest.java | 51 +-
.../calcite/exec/rel/TableSpoolExecutionTest.java | 12 +-
.../exec/rel/TreeIndexSpoolExecutionTest.java | 30 +-
.../planner/AbstractAggregatePlannerTest.java | 8 +-
.../query/calcite/planner/AbstractPlannerTest.java | 421 +++++-----
.../planner/AggregateDistinctPlannerTest.java | 30 +-
.../calcite/planner/AggregatePlannerTest.java | 39 +-
.../CorrelatedNestedLoopJoinPlannerTest.java | 6 +-
.../calcite/planner/HashAggregatePlannerTest.java | 9 +-
.../calcite/planner/HashIndexSpoolPlannerTest.java | 9 +-
.../query/calcite/planner/PlannerTest.java | 871 +++++++++++----------
.../query/calcite/planner/SetOpPlannerTest.java | 72 +-
.../calcite/planner/SortAggregatePlannerTest.java | 12 +-
.../planner/SortedIndexSpoolPlannerTest.java | 9 +-
.../query/calcite/planner/TableDmlPlannerTest.java | 15 +
.../calcite/planner/TableFunctionPlannerTest.java | 16 +-
.../calcite/planner/TableSpoolPlannerTest.java | 6 +
.../ignite/internal/calcite/util/Commons.java | 4 +
.../ignite/internal/schema/AssemblyException.java | 4 +
.../apache/ignite/internal/schema/BinaryRow.java | 26 +-
.../ignite/internal/schema/BitmaskNativeType.java | 5 +-
.../ignite/internal/schema/ByteBufferRow.java | 2 +
.../org/apache/ignite/internal/schema/Column.java | 18 +-
.../org/apache/ignite/internal/schema/Columns.java | 44 +-
.../ignite/internal/schema/DecimalNativeType.java | 4 +-
.../internal/schema/InvalidTypeException.java | 2 +
.../apache/ignite/internal/schema/NativeType.java | 10 +-
.../ignite/internal/schema/NativeTypeSpec.java | 2 +-
.../apache/ignite/internal/schema/NativeTypes.java | 100 +--
.../ignite/internal/schema/NumberNativeType.java | 5 +-
.../ignite/internal/schema/SchemaDescriptor.java | 22 +
.../schema/SchemaModificationException.java | 2 +-
.../ignite/internal/schema/SchemaRegistry.java | 5 +-
.../ignite/internal/schema/VarlenNativeType.java | 4 +-
.../SchemaConfigurationConverter.java | 3 +
.../configuration/SchemaDescriptorConverter.java | 2 +
.../schema/definition/TableDefinitionImpl.java | 4 +
.../builder/PrimaryKeyDefinitionBuilderImpl.java | 2 +-
.../builder/SortedIndexDefinitionBuilderImpl.java | 5 +-
.../internal/schema/mapping/ColumnMapperImpl.java | 5 +
.../internal/schema/mapping/ColumnMapping.java | 6 +
.../internal/schema/marshaller/BinaryMode.java | 4 +-
.../internal/schema/marshaller/Serializer.java | 11 +-
.../schema/marshaller/SerializerFactory.java | 6 +
.../marshaller/asm/ColumnAccessCodeGenerator.java | 5 +-
.../marshaller/asm/MarshallerCodeGenerator.java | 17 +-
.../schema/marshaller/reflection/Marshaller.java | 38 +-
.../schema/AbstractSchemaSerializer.java | 8 +-
.../schema/marshaller/schema/SchemaSerializer.java | 2 +
.../schema/registry/SchemaRegistryImpl.java | 3 +
.../schema/registry/UpgradingRowAdapter.java | 2 +
.../internal/schema/row/ExpandableByteBuf.java | 8 +-
.../org/apache/ignite/internal/schema/row/Row.java | 21 +-
.../ignite/internal/schema/row/RowAssembler.java | 421 +++++-----
.../internal/schema/row/TemporalTypesHelper.java | 3 +
.../ignite/internal/schema/row/VarTableFormat.java | 94 +--
.../java/org/apache/ignite/internal/util/Pair.java | 4 +-
.../benchmarks/SerializerBenchmarkTest.java | 61 +-
.../internal/schema/ColumnDefinitionTest.java | 6 +-
.../apache/ignite/internal/schema/ColumnsTest.java | 60 +-
.../internal/schema/ExpandableByteBufTest.java | 18 +-
.../ignite/internal/schema/NativeTypeTest.java | 68 +-
.../schema/RowAssemblerAdvancedSchemaTest.java | 2 +
.../schema/RowAssemblerSimpleSchemaTest.java | 2 +
.../internal/schema/SchemaConfigurationTest.java | 9 +-
.../internal/schema/SchemaDescriptorTest.java | 6 +-
.../ignite/internal/schema/TemporalTypesTest.java | 6 +
.../configuration/TableValidatorImplTest.java | 3 +-
.../schema/marshaller/JavaSerializerTest.java | 298 +++----
.../marshaller/reflection/FieldAccessorTest.java | 16 +-
.../schema/registry/SchemaRegistryImplTest.java | 3 +
333 files changed, 4787 insertions(+), 7706 deletions(-)
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/ResultFieldMetadata.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/ResultFieldMetadata.java
index cde083b..a24d849 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/ResultFieldMetadata.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/ResultFieldMetadata.java
@@ -25,29 +25,30 @@ import org.apache.ignite.internal.schema.NativeType;
*/
public interface ResultFieldMetadata {
/**
- * @return name of the result's field.
+ * Get name of the result's field.
*/
String name();
-
+
/**
- * @return index (order) of the result's field (starts from 0).
+ * Get index (order) of the result's field (starts from 0).
*/
int order();
-
+
/**
- * @return type of the result's field.
+ * Get type of the result's field.
*/
NativeType type();
-
+
/**
- * @return nullable flag of the result's field.
+ * Get nullable flag of the result's field.
*/
boolean isNullable();
-
+
/**
- * Example: SELECT SUM(price), category, subcategory FROM Goods WHERE [condition] GROUP_BY category, subcategory;
+ * Example: SELECT SUM(price), category, subcategory FROM Goods WHERE [condition] GROUP_BY category, subcategory.
*
- * <p>Field - Origin SUM(price) - null; category - {"PUBLIC", "Goods", "category"}; subcategory - {"PUBLIC", "Goods", "subcategory"};
+ * <p>Field - Origin SUM(price) - null; category - {"PUBLIC", "Goods", "category"};
+ * subcategory - {"PUBLIC", "Goods", "subcategory"};
*
* @return field's origin (or where a field value comes from).
*/
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/ResultSetMetadata.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/ResultSetMetadata.java
index 2a93a80..4d642c7 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/ResultSetMetadata.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/ResultSetMetadata.java
@@ -24,7 +24,7 @@ import java.util.List;
*/
public interface ResultSetMetadata {
/**
- * @return Fields metadata.
+ * Get fields metadata.
*/
List<ResultFieldMetadata> fields();
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlCursor.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlCursor.java
index fc32f03..bbd3a7e 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlCursor.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlCursor.java
@@ -26,12 +26,12 @@ import org.apache.ignite.internal.util.Cursor;
*/
public interface SqlCursor<T> extends Cursor<T> {
/**
- * @return Query type.
+ * Get query type.
*/
SqlQueryType queryType();
/**
- * @return Column metadata.
+ * Get column metadata.
*/
ResultSetMetadata metadata();
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlQueryProcessor.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlQueryProcessor.java
index a0b79d8..3b297f2 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlQueryProcessor.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlQueryProcessor.java
@@ -44,29 +44,33 @@ import org.apache.ignite.network.ClusterService;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+/**
+ * SqlQueryProcessor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ */
public class SqlQueryProcessor implements QueryProcessor {
/** Size of the cache for query plans. */
public static final int PLAN_CACHE_SIZE = 1024;
-
+
private volatile ExecutionService executionSrvc;
-
+
private volatile MessageService msgSrvc;
-
+
private volatile QueryTaskExecutor taskExecutor;
-
+
private final ClusterService clusterSrvc;
-
+
private final TableManager tableManager;
-
+
/** Busy lock for stop synchronisation. */
private final IgniteSpinBusyLock busyLock = new IgniteSpinBusyLock();
-
+
/** Keeps queries plans to avoid expensive planning of the same queries. */
private final QueryPlanCache planCache = new QueryPlanCacheImpl(PLAN_CACHE_SIZE);
-
+
/** Event listeners to close. */
private final List<Pair<TableEvent, EventListener>> evtLsnrs = new ArrayList<>();
-
+
public SqlQueryProcessor(
ClusterService clusterSrvc,
TableManager tableManager
@@ -74,20 +78,20 @@ public class SqlQueryProcessor implements QueryProcessor {
this.clusterSrvc = clusterSrvc;
this.tableManager = tableManager;
}
-
+
/** {@inheritDoc} */
@Override
public void start() {
taskExecutor = new QueryTaskExecutorImpl(clusterSrvc.localConfiguration().getName());
-
+
msgSrvc = new MessageServiceImpl(
clusterSrvc.topologyService(),
clusterSrvc.messagingService(),
taskExecutor
);
-
+
SchemaHolderImpl schemaHolder = new SchemaHolderImpl(planCache::clear);
-
+
executionSrvc = new ExecutionServiceImpl<>(
clusterSrvc.topologyService(),
msgSrvc,
@@ -96,83 +100,80 @@ public class SqlQueryProcessor implements QueryProcessor {
taskExecutor,
ArrayRowHandler.INSTANCE
);
-
+
registerTableListener(TableEvent.CREATE, new TableCreatedListener(schemaHolder));
registerTableListener(TableEvent.ALTER, new TableUpdatedListener(schemaHolder));
registerTableListener(TableEvent.DROP, new TableDroppedListener(schemaHolder));
-
+
taskExecutor.start();
msgSrvc.start();
executionSrvc.start();
planCache.start();
}
-
- /**
- *
- */
+
private void registerTableListener(TableEvent evt, AbstractTableEventListener lsnr) {
evtLsnrs.add(Pair.of(evt, lsnr));
-
+
tableManager.listen(evt, lsnr);
}
-
+
/** {@inheritDoc} */
@SuppressWarnings("unchecked")
@Override
public void stop() throws Exception {
busyLock.block();
-
+
List<AutoCloseable> toClose = new ArrayList<>(Arrays.asList(
executionSrvc::stop,
msgSrvc::stop,
taskExecutor::stop,
planCache::stop
));
-
+
toClose.addAll(evtLsnrs.stream()
.map((p) -> (AutoCloseable) () -> tableManager.removeListener(p.left, p.right))
.collect(Collectors.toList()));
-
+
IgniteUtils.closeAll(toClose);
}
-
+
/** {@inheritDoc} */
@Override
public List<SqlCursor<List<?>>> query(String schemaName, String qry, Object... params) {
if (!busyLock.enterBusy()) {
throw new IgniteException(new NodeStoppingException());
}
-
+
try {
return executionSrvc.executeQuery(schemaName, qry, params);
} finally {
busyLock.leaveBusy();
}
}
-
+
private abstract static class AbstractTableEventListener implements EventListener<TableEventParameters> {
protected final SchemaHolderImpl schemaHolder;
-
+
private AbstractTableEventListener(
SchemaHolderImpl schemaHolder
) {
this.schemaHolder = schemaHolder;
}
-
+
/** {@inheritDoc} */
@Override
public void remove(@NotNull Throwable exception) {
// No-op.
}
}
-
+
private static class TableCreatedListener extends AbstractTableEventListener {
private TableCreatedListener(
SchemaHolderImpl schemaHolder
) {
super(schemaHolder);
}
-
+
/** {@inheritDoc} */
@Override
public boolean notify(@NotNull TableEventParameters parameters, @Nullable Throwable exception) {
@@ -180,18 +181,18 @@ public class SqlQueryProcessor implements QueryProcessor {
"PUBLIC",
parameters.table()
);
-
+
return false;
}
}
-
+
private static class TableUpdatedListener extends AbstractTableEventListener {
private TableUpdatedListener(
SchemaHolderImpl schemaHolder
) {
super(schemaHolder);
}
-
+
/** {@inheritDoc} */
@Override
public boolean notify(@NotNull TableEventParameters parameters, @Nullable Throwable exception) {
@@ -199,18 +200,18 @@ public class SqlQueryProcessor implements QueryProcessor {
"PUBLIC",
parameters.table()
);
-
+
return false;
}
}
-
+
private static class TableDroppedListener extends AbstractTableEventListener {
private TableDroppedListener(
SchemaHolderImpl schemaHolder
) {
super(schemaHolder);
}
-
+
/** {@inheritDoc} */
@Override
public boolean notify(@NotNull TableEventParameters parameters, @Nullable Throwable exception) {
@@ -218,7 +219,7 @@ public class SqlQueryProcessor implements QueryProcessor {
"PUBLIC",
parameters.tableName()
);
-
+
return false;
}
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlQueryType.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlQueryType.java
index b97fef1..b2da10c 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlQueryType.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/SqlQueryType.java
@@ -36,6 +36,8 @@ public enum SqlQueryType {
EXPLAIN;
/**
+ * Map query plan type to sql type.
+ *
* @param type QueryPlan.Type.
* @return Associated SqlQueryType.
*/
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/Stubs.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/Stubs.java
index d76bda6..f6501c7 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/Stubs.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/Stubs.java
@@ -17,11 +17,8 @@
package org.apache.ignite.internal.processors.query.calcite;
-/** Stubs */
+/** Stubs. */
public class Stubs {
- /**
- *
- */
public static int intFoo(Object... args) {
return args == null ? 0 : args.length;
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/AbstractIndexScan.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/AbstractIndexScan.java
index 1fdb246..c9c6211 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/AbstractIndexScan.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/AbstractIndexScan.java
@@ -30,9 +30,6 @@ import org.apache.ignite.lang.IgniteInternalException;
* Abstract index scan.
*/
public abstract class AbstractIndexScan<RowT, IdxRowT> implements Iterable<RowT>, AutoCloseable {
- /**
- *
- */
private final TreeIndex<IdxRowT> idx;
/** Additional filters. */
@@ -44,27 +41,22 @@ public abstract class AbstractIndexScan<RowT, IdxRowT> implements Iterable<RowT>
/** Upper index scan bound. */
private final Supplier<RowT> upperBound;
- /**
- *
- */
private final Function<RowT, RowT> rowTransformer;
- /**
- *
- */
protected final ExecutionContext<RowT> ectx;
- /**
- *
- */
protected final RelDataType rowType;
/**
+ * Constructor.
+ *
* @param ectx Execution context.
+ * @param rowType Rel data type.
* @param idx Physical index.
* @param filters Additional filters.
* @param lowerBound Lower index scan bound.
* @param upperBound Upper index scan bound.
+ * @param rowTransformer Row transformer.
*/
protected AbstractIndexScan(
ExecutionContext<RowT> ectx,
@@ -104,14 +96,8 @@ public abstract class AbstractIndexScan<RowT, IdxRowT> implements Iterable<RowT>
return it;
}
- /**
- *
- */
protected abstract IdxRowT row2indexRow(RowT bound);
- /**
- *
- */
protected abstract RowT indexRow2Row(IdxRowT idxRow) throws IgniteInternalException;
/** {@inheritDoc} */
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ArrayRowHandler.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ArrayRowHandler.java
index 44e8489..87d6322 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ArrayRowHandler.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ArrayRowHandler.java
@@ -25,14 +25,8 @@ import org.apache.ignite.internal.util.ArrayUtils;
* Handler for rows that implemented as a simple objects array.
*/
public class ArrayRowHandler implements RowHandler<Object[]> {
- /**
- *
- */
public static final RowHandler<Object[]> INSTANCE = new ArrayRowHandler();
- /**
- *
- */
private ArrayRowHandler() {
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ClosableIteratorsHolder.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ClosableIteratorsHolder.java
index b55d4ff..7a8112e 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ClosableIteratorsHolder.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ClosableIteratorsHolder.java
@@ -29,42 +29,26 @@ import org.apache.ignite.internal.thread.IgniteThread;
import org.apache.ignite.lang.IgniteLogger;
/**
- *
+ * ClosableIteratorsHolder.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public class ClosableIteratorsHolder implements LifecycleAware {
- /**
- *
- */
private final String nodeName;
- /**
- *
- */
private final ReferenceQueue refQueue;
- /**
- *
- */
private final Map<Reference, Object> refMap;
- /**
- *
- */
private final IgniteLogger log;
- /**
- *
- */
private volatile boolean stopped;
- /**
- *
- */
private volatile IgniteThread cleanWorker;
/**
- *
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public ClosableIteratorsHolder(String nodeName, IgniteLogger log) {
this.nodeName = nodeName;
@@ -83,6 +67,9 @@ public class ClosableIteratorsHolder implements LifecycleAware {
}
/**
+ * Iterator.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param src Closeable iterator.
* @return Weak closable iterator wrapper.
*/
@@ -92,18 +79,12 @@ public class ClosableIteratorsHolder implements LifecycleAware {
return new DelegatingIterator<>(src);
}
- /**
- *
- */
private void cleanUp(boolean blocking) {
for (Reference<?> ref = nextRef(blocking); !stopped && ref != null; ref = nextRef(blocking)) {
Commons.close(refMap.remove(ref), log);
}
}
- /**
- *
- */
private Reference nextRef(boolean blocking) {
try {
return !blocking ? refQueue.poll() : refQueue.remove();
@@ -112,9 +93,6 @@ public class ClosableIteratorsHolder implements LifecycleAware {
}
}
- /**
- *
- */
private AutoCloseable closeable(Object referent, Object resource) {
if (!(resource instanceof AutoCloseable)) {
return null;
@@ -139,23 +117,11 @@ public class ClosableIteratorsHolder implements LifecycleAware {
}
}
- /**
- *
- */
private final class DelegatingIterator<T> implements Iterator<T>, AutoCloseable {
- /**
- *
- */
private final Iterator<T> delegate;
- /**
- *
- */
private final AutoCloseable closeable;
- /**
- *
- */
private DelegatingIterator(Iterator<T> delegate) {
closeable = closeable(this, this.delegate = delegate);
}
@@ -191,13 +157,7 @@ public class ClosableIteratorsHolder implements LifecycleAware {
}
}
- /**
- *
- */
private final class CloseableReference extends WeakReference implements AutoCloseable {
- /**
- *
- */
private CloseableReference(Object referent, Object resource) {
super(referent, refQueue);
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExchangeService.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExchangeService.java
index fe72141..86a5be0 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExchangeService.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExchangeService.java
@@ -22,7 +22,8 @@ import java.util.UUID;
import org.apache.ignite.lang.IgniteInternalCheckedException;
/**
- *
+ * ExchangeService interface.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public interface ExchangeService extends LifecycleAware {
/**
@@ -71,6 +72,9 @@ public interface ExchangeService extends LifecycleAware {
void closeOutbox(String nodeId, UUID qryId, long fragmentId, long exchangeId) throws IgniteInternalCheckedException;
/**
+ * Send error.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param nodeId Target node ID.
* @param qryId Query ID.
* @param fragmentId Source fragment ID.
@@ -80,6 +84,9 @@ public interface ExchangeService extends LifecycleAware {
void sendError(String nodeId, UUID qryId, long fragmentId, Throwable err) throws IgniteInternalCheckedException;
/**
+ * Alive.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param nodeId Node ID.
* @return {@code true} if node is alive, {@code false} otherwise.
*/
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExchangeServiceImpl.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExchangeServiceImpl.java
index 7ea0989..52a45fd 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExchangeServiceImpl.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExchangeServiceImpl.java
@@ -40,30 +40,23 @@ import org.apache.ignite.lang.IgniteInternalException;
import org.apache.ignite.lang.IgniteLogger;
/**
- *
+ * ExchangeServiceImpl.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class ExchangeServiceImpl implements ExchangeService {
private static final IgniteLogger LOG = IgniteLogger.forClass(ExchangeServiceImpl.class);
private static final SqlQueryMessagesFactory FACTORY = new SqlQueryMessagesFactory();
- /**
- *
- */
private final QueryTaskExecutor taskExecutor;
- /**
- *
- */
private final MailboxRegistry mailboxRegistry;
- /**
- *
- */
private final MessageService msgSrvc;
/**
- *
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public ExchangeServiceImpl(
QueryTaskExecutor taskExecutor,
@@ -161,9 +154,6 @@ public class ExchangeServiceImpl implements ExchangeService {
return msgSrvc.alive(nodeId);
}
- /**
- *
- */
protected void onMessage(String nodeId, InboxCloseMessage msg) {
Collection<Inbox<?>> inboxes = mailboxRegistry.inboxes(msg.queryId(), msg.fragmentId(), msg.exchangeId());
@@ -180,9 +170,6 @@ public class ExchangeServiceImpl implements ExchangeService {
}
}
- /**
- *
- */
protected void onMessage(String nodeId, OutboxCloseMessage msg) {
Collection<Outbox<?>> outboxes = mailboxRegistry.outboxes(msg.queryId(), msg.fragmentId(), msg.exchangeId());
@@ -203,9 +190,6 @@ public class ExchangeServiceImpl implements ExchangeService {
}
}
- /**
- *
- */
protected void onMessage(String nodeId, QueryBatchAcknowledgeMessage msg) {
Outbox<?> outbox = mailboxRegistry.outbox(msg.queryId(), msg.exchangeId());
@@ -227,9 +211,6 @@ public class ExchangeServiceImpl implements ExchangeService {
}
}
- /**
- *
- */
protected void onMessage(String nodeId, QueryBatchMessage msg) {
Inbox<?> inbox = mailboxRegistry.inbox(msg.queryId(), msg.exchangeId());
@@ -261,7 +242,7 @@ public class ExchangeServiceImpl implements ExchangeService {
}
/**
- * @return Minimal execution context to meet Inbox needs.
+ * Get minimal execution context to meet Inbox needs.
*/
private ExecutionContext<?> baseInboxContext(String nodeId, UUID qryId, long fragmentId) {
return new ExecutionContext<>(
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionCancelledException.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionCancelledException.java
index 937279a..fd5b12b 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionCancelledException.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionCancelledException.java
@@ -20,7 +20,8 @@ package org.apache.ignite.internal.processors.query.calcite.exec;
import org.apache.ignite.lang.IgniteInternalCheckedException;
/**
- *
+ * ExecutionCancelledException.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class ExecutionCancelledException extends IgniteInternalCheckedException {
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionContext.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionContext.java
index 94e82de..feb1fea 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionContext.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionContext.java
@@ -44,63 +44,35 @@ import org.jetbrains.annotations.NotNull;
* Runtime context allowing access to the tables in a database.
*/
public class ExecutionContext<RowT> implements DataContext {
- /**
- *
- */
private static final TimeZone TIME_ZONE = TimeZone.getDefault(); // TODO DistributedSqlConfiguration#timeZone
- /**
- *
- */
private final UUID qryId;
- /**
- *
- */
private final PlanningContext ctx;
- /**
- *
- */
private final FragmentDescription fragmentDesc;
- /**
- *
- */
private final Map<String, Object> params;
- /**
- *
- */
private final QueryTaskExecutor executor;
- /**
- *
- */
private final RowHandler<RowT> handler;
- /**
- *
- */
private final ExpressionFactory<RowT> expressionFactory;
- /**
- *
- */
private final AtomicBoolean cancelFlag = new AtomicBoolean();
/**
- * Need to store timestamp, since SQL standard says that functions such as CURRENT_TIMESTAMP return the same value throughout the
- * query.
+ * Need to store timestamp, since SQL standard says that functions such as CURRENT_TIMESTAMP return the same value
+ * throughout the query.
*/
private final long startTs;
- /**
- *
- */
private Object[] correlations = new Object[16];
/**
+ * Constructor.
+ *
* @param executor Task executor.
* @param ctx Parent context.
* @param qryId Query ID.
@@ -131,34 +103,36 @@ public class ExecutionContext<RowT> implements DataContext {
}
/**
- * @return Parent context.
+ * Get parent context.
*/
public PlanningContext planningContext() {
return ctx;
}
/**
- * @return Query ID.
+ * Get query ID.
*/
public UUID queryId() {
return qryId;
}
/**
- * @return Fragment ID.
+ * Get fragment ID.
*/
public long fragmentId() {
return fragmentDesc.fragmentId();
}
/**
- * @return Target mapping.
+ * Get target mapping.
*/
public ColocationGroup target() {
return fragmentDesc.target();
}
/**
+ * Get remote nodes for the given exchange id.
+ *
* @param exchangeId ExchangeId to find remote nodes for.
* @return Remote nodes for given exchangeId.
*/
@@ -167,6 +141,8 @@ public class ExecutionContext<RowT> implements DataContext {
}
/**
+ * Get colocation group for the given source id.
+ *
* @param sourceId SourceId to find colocation group for.
* @return Colocation group for given sourceId.
*/
@@ -175,28 +151,28 @@ public class ExecutionContext<RowT> implements DataContext {
}
/**
- * @return Keep binary flag.
+ * Get keep binary flag.
*/
public boolean keepBinary() {
return true; // TODO
}
/**
- * @return Handler to access row fields.
+ * Get handler to access row fields.
*/
public RowHandler<RowT> rowHandler() {
return handler;
}
/**
- * @return Expression factory.
+ * Get expression factory.
*/
public ExpressionFactory<RowT> expressionFactory() {
return expressionFactory;
}
/**
- * @return Originating node ID.
+ * Get originating node ID.
*/
public String originatingNodeId() {
return planningContext().originatingNodeId();
@@ -309,13 +285,10 @@ public class ExecutionContext<RowT> implements DataContext {
}
/**
- *
+ * RunnableX interface.
*/
@FunctionalInterface
public interface RunnableX {
- /**
- *
- */
void run() throws Throwable;
}
@@ -328,9 +301,6 @@ public class ExecutionContext<RowT> implements DataContext {
return !cancelFlag.get() && cancelFlag.compareAndSet(false, true);
}
- /**
- *
- */
public boolean isCancelled() {
return cancelFlag.get();
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
index 5ec5583..33c373d 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionService.java
@@ -22,7 +22,8 @@ import java.util.UUID;
import org.apache.ignite.internal.processors.query.calcite.SqlCursor;
/**
- *
+ * ExecutionService interface.
+ * // TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public interface ExecutionService extends LifecycleAware {
/**
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionServiceImpl.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionServiceImpl.java
index e08b975..0d369e3 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionServiceImpl.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/ExecutionServiceImpl.java
@@ -108,83 +108,46 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
- *
+ * ExecutionServiceImpl.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class ExecutionServiceImpl<RowT> implements ExecutionService {
private static final IgniteLogger LOG = IgniteLogger.forClass(ExecutionServiceImpl.class);
-
+
private static final SqlQueryMessagesFactory FACTORY = new SqlQueryMessagesFactory();
-
- /**
- *
- */
+
private final TopologyService topSrvc;
-
- /**
- *
- */
+
private final MessageService msgSrvc;
-
- /**
- *
- */
+
private final String locNodeId;
-
- /**
- *
- */
+
private final QueryPlanCache qryPlanCache;
-
- /**
- *
- */
+
private final SchemaHolder schemaHolder;
-
- /**
- *
- */
+
private final QueryTaskExecutor taskExecutor;
-
- /**
- *
- */
+
private final AffinityService affSrvc;
-
- /**
- *
- */
+
private final MailboxRegistry mailboxRegistry;
-
- /**
- *
- */
+
private final MappingService mappingSrvc;
-
- /**
- *
- */
+
private final ExchangeService exchangeSrvc;
-
- /**
- *
- */
+
private final ClosableIteratorsHolder iteratorsHolder;
-
- /**
- *
- */
+
private final Map<UUID, QueryInfo> running;
-
- /**
- *
- */
+
private final RowHandler<RowT> handler;
-
+
+ private final DdlSqlToCommandConverter ddlConverter;
+
/**
- *
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
- private final DdlSqlToCommandConverter ddlConverter;
-
public ExecutionServiceImpl(
TopologyService topSrvc,
MessageService msgSrvc,
@@ -198,7 +161,7 @@ public class ExecutionServiceImpl<RowT> implements ExecutionService {
this.msgSrvc = msgSrvc;
this.schemaHolder = schemaHolder;
this.taskExecutor = taskExecutor;
-
+
locNodeId = topSrvc.localMember().id();
qryPlanCache = planCache;
running = new ConcurrentHashMap<>();
@@ -210,21 +173,21 @@ public class ExecutionServiceImpl<RowT> implements ExecutionService {
// TODO: fix this
affSrvc = cacheId -> Objects::hashCode;
}
-
+
/** {@inheritDoc} */
@Override
public void start() {
iteratorsHolder.start();
mailboxRegistry.start();
exchangeSrvc.start();
-
+
topSrvc.addEventHandler(new NodeLeaveHandler(this::onNodeLeft));
-
+
msgSrvc.register((n, m) -> onMessage(n, (QueryStartRequest) m), SqlQueryMessageGroup.QUERY_START_REQUEST);
msgSrvc.register((n, m) -> onMessage(n, (QueryStartResponse) m), SqlQueryMessageGroup.QUERY_START_RESPONSE);
msgSrvc.register((n, m) -> onMessage(n, (ErrorMessage) m), SqlQueryMessageGroup.ERROR_MESSAGE);
}
-
+
/** {@inheritDoc} */
@Override
public List<SqlCursor<List<?>>> executeQuery(
@@ -233,41 +196,38 @@ public class ExecutionServiceImpl<RowT> implements ExecutionService {
Object[] params
) {
PlanningContext pctx = createContext(topologyVersion(), locNodeId, schema, qry, params);
-
+
List<QueryPlan> qryPlans = qryPlanCache.queryPlan(pctx, new CacheKey(pctx.schemaName(), pctx.query()), this::prepareQuery);
-
+
return executePlans(qryPlans, pctx);
}
-
- /**
- *
- */
+
private SqlCursor<List<?>> executeQuery(UUID qryId, MultiStepPlan plan, PlanningContext pctx) {
plan.init(pctx);
-
+
List<Fragment> fragments = plan.fragments();
-
+
// Local execution
Fragment fragment = first(fragments);
-
+
if (IgniteUtils.assertionsEnabled()) {
assert fragment != null;
-
+
FragmentMapping mapping = plan.mapping(fragment);
-
+
assert mapping != null;
-
+
List<String> nodes = mapping.nodeIds();
-
+
assert nodes != null && nodes.size() == 1 && first(nodes).equals(pctx.localNodeId());
}
-
+
FragmentDescription fragmentDesc = new FragmentDescription(
fragment.fragmentId(),
plan.mapping(fragment),
plan.target(fragment),
plan.remotes(fragment));
-
+
ExecutionContext<RowT> ectx = new ExecutionContext<>(
taskExecutor,
pctx,
@@ -275,15 +235,15 @@ public class ExecutionServiceImpl<RowT> implements ExecutionService {
fragmentDesc,
handler,
Commons.parametersMap(pctx.parameters()));
-
+
Node<RowT> node = new LogicalRelImplementor<>(ectx, affSrvc, mailboxRegistry,
exchangeSrvc).go(fragment.root());
-
+
QueryInfo info = new QueryInfo(ectx, plan, node);
-
+
// register query
register(info);
-
+
// start remote execution
for (int i = 1; i < fragments.size(); i++) {
fragment = fragments.get(i);
@@ -292,7 +252,7 @@ public class ExecutionServiceImpl<RowT> implements ExecutionService {
plan.mapping(fragment),
plan.target(fragment),
plan.remotes(fragment));
-
+
Throwable ex = null;
for (String nodeId : fragmentDesc.nodeIds()) {
if (ex != null) {
@@ -308,7 +268,7 @@ public class ExecutionServiceImpl<RowT> implements ExecutionService {
.fragmentDescription(fragmentDesc)
.parameters(pctx.parameters())
.build();
-
+
msgSrvc.send(nodeId, req);
} catch (Throwable e) {
info.onResponse(nodeId, fragment.fragmentId(), ex = e);
@@ -316,20 +276,20 @@ public class ExecutionServiceImpl<RowT> implements ExecutionService {
}
}
}
-
+
return Commons.createCursor(new TransformingIterator<>(info.iterator(), row -> {
int rowSize = ectx.rowHandler().columnCount(row);
-
+
List<Object> res = new ArrayList<>(rowSize);
-
+
for (int i = 0; i < rowSize; i++) {
res.add(ectx.rowHandler().get(i, row));
}
-
+
return res;
}), plan);
}
-
+
/**
* Executes prepared plans.
*
@@ -343,38 +303,32 @@ public class ExecutionServiceImpl<RowT> implements ExecutionService {
PlanningContext pctx
) {
List<SqlCursor<List<?>>> cursors = new ArrayList<>(qryPlans.size());
-
+
for (QueryPlan plan : qryPlans) {
UUID qryId = UUID.randomUUID();
-
+
SqlCursor<List<?>> cur = executePlan(qryId, pctx, plan);
-
+
cursors.add(cur);
}
-
+
return cursors;
}
-
+
/** {@inheritDoc} */
@Override
public void cancelQuery(UUID qryId) {
QueryInfo info = running.get(qryId);
-
+
if (info != null) {
info.cancel();
}
}
-
- /**
- *
- */
+
protected long topologyVersion() {
return 1L;
}
-
- /**
- *
- */
+
private PlanningContext createContext(long topVer, String originator,
@Nullable String schema, String qry, Object[] params) {
RelTraitDef<?>[] traitDefs = {
@@ -384,7 +338,7 @@ public class ExecutionServiceImpl<RowT> implements ExecutionService {
RewindabilityTraitDef.INSTANCE,
CorrelationTraitDef.INSTANCE,
};
-
+
return PlanningContext.builder()
.localNodeId(locNodeId)
.originatingNodeId(originator)
@@ -400,30 +354,27 @@ public class ExecutionServiceImpl<RowT> implements ExecutionService {
.topologyVersion(topVer)
.build();
}
-
- /**
- *
- */
+
private List<QueryPlan> prepareQuery(PlanningContext ctx) {
try {
String qry = ctx.query();
-
+
assert qry != null;
-
+
// Parse query.
SqlNode sqlNode = ctx.planner().parse(qry);
-
+
if (single(sqlNode)) {
return singletonList(prepareSingle(sqlNode, ctx));
}
-
+
List<SqlNode> nodes = ((SqlNodeList) sqlNode).getList();
List<QueryPlan> res = new ArrayList<>(nodes.size());
-
+
for (SqlNode node : nodes) {
res.add(prepareSingle(node, ctx));
}
-
+
return res;
} catch (SqlParseException e) {
throw new IgniteInternalException("Failed to parse query", e);
@@ -433,43 +384,34 @@ public class ExecutionServiceImpl<RowT> implements ExecutionService {
throw new IgniteInternalException("Failed to plan query.", e);
}
}
-
- /**
- *
- */
+
private QueryPlan prepareQuery(SqlNode sqlNode, PlanningContext ctx) {
IgnitePlanner planner = ctx.planner();
-
+
// Validate
ValidationResult validated = planner.validateAndGetTypeMetadata(sqlNode);
-
+
sqlNode = validated.sqlNode();
-
+
IgniteRel igniteRel = optimize(sqlNode, planner, LOG);
-
+
// Split query plan to query fragments.
List<Fragment> fragments = new Splitter().go(igniteRel);
-
+
QueryTemplate template = new QueryTemplate(mappingSrvc, fragments);
-
+
return new MultiStepQueryPlan(template, resultSetMetadata(ctx, validated.dataType(), validated.origins()));
}
-
- /**
- *
- */
+
private List<QueryPlan> prepareFragment(PlanningContext ctx) {
return List.of(new FragmentPlan(fromJson(ctx, ctx.query())));
}
-
- /**
- *
- */
+
private QueryPlan prepareSingle(SqlNode sqlNode, PlanningContext ctx) throws ValidationException {
assert single(sqlNode);
-
+
ctx.planner().reset();
-
+
switch (sqlNode.getKind()) {
case SELECT:
case ORDER_BY:
@@ -479,92 +421,77 @@ public class ExecutionServiceImpl<RowT> implements ExecutionService {
case EXCEPT:
case INTERSECT:
return prepareQuery(sqlNode, ctx);
-
+
case INSERT:
case DELETE:
case UPDATE:
return prepareDml(sqlNode, ctx);
-
+
case EXPLAIN:
return prepareExplain(sqlNode, ctx);
-
+
case CREATE_TABLE:
case DROP_TABLE:
return prepareDdl(sqlNode, ctx);
-
+
default:
throw new IgniteInternalException("Unsupported operation ["
+ "sqlNodeKind=" + sqlNode.getKind() + "; "
+ "querySql=\"" + ctx.query() + "\"]");
}
}
-
- /**
- *
- */
+
private QueryPlan prepareDml(SqlNode sqlNode, PlanningContext ctx) throws ValidationException {
IgnitePlanner planner = ctx.planner();
-
+
// Validate
sqlNode = planner.validate(sqlNode);
-
+
// Convert to Relational operators graph
IgniteRel igniteRel = optimize(sqlNode, planner, LOG);
-
+
// Split query plan to query fragments.
List<Fragment> fragments = new Splitter().go(igniteRel);
-
+
QueryTemplate template = new QueryTemplate(mappingSrvc, fragments);
-
+
return new MultiStepDmlPlan(template, resultSetMetadata(ctx, igniteRel.getRowType(), null));
}
-
- /**
- *
- */
+
private QueryPlan prepareDdl(SqlNode sqlNode, PlanningContext ctx) {
assert sqlNode instanceof SqlDdl : sqlNode == null ? "null" : sqlNode.getClass().getName();
-
+
SqlDdl ddlNode = (SqlDdl) sqlNode;
-
+
return new DdlPlan(ddlConverter.convert(ddlNode, ctx));
}
-
- /**
- *
- */
+
private QueryPlan prepareExplain(SqlNode explain, PlanningContext ctx) throws ValidationException {
IgnitePlanner planner = ctx.planner();
-
+
SqlNode sql = ((SqlExplain) explain).getExplicandum();
-
+
// Validate
sql = planner.validate(sql);
-
+
// Convert to Relational operators graph
IgniteRel igniteRel = optimize(sql, planner, LOG);
-
+
String plan = RelOptUtil.toString(igniteRel, SqlExplainLevel.ALL_ATTRIBUTES);
-
+
return new ExplainPlan(plan, explainFieldsMetadata(ctx));
}
-
- /**
- *
- */
+
private ResultSetMetadata explainFieldsMetadata(PlanningContext ctx) {
IgniteTypeFactory factory = ctx.typeFactory();
RelDataType planStrDataType =
factory.createSqlType(SqlTypeName.VARCHAR, PRECISION_NOT_SPECIFIED);
Map.Entry<String, RelDataType> planField = new IgniteBiTuple<>(ExplainPlan.PLAN_COL_NAME, planStrDataType);
RelDataType planDataType = factory.createStructType(singletonList(planField));
-
+
return resultSetMetadata(ctx, planDataType, null);
}
-
- /**
- *
- */
+
private SqlCursor<List<?>> executePlan(UUID qryId, PlanningContext pctx, QueryPlan plan) {
switch (plan.type()) {
case DML:
@@ -575,47 +502,38 @@ public class ExecutionServiceImpl<RowT> implements ExecutionService {
return executeExplain((ExplainPlan) plan);
case DDL:
return executeDdl((DdlPlan) plan, pctx);
-
+
default:
throw new AssertionError("Unexpected plan type: " + plan);
}
}
-
- /**
- *
- */
+
private SqlCursor<List<?>> executeDdl(DdlPlan plan, PlanningContext pctx) {
throw new UnsupportedOperationException("plan=" + plan + ", ctx=" + pctx);
}
-
- /**
- *
- */
+
private SqlCursor<List<?>> executeExplain(ExplainPlan plan) {
SqlCursor<List<?>> cur = Commons.createCursor(singletonList(singletonList(plan.plan())), plan);
// TODO: fix this
// cur.fieldsMeta(plan.fieldsMeta().queryFieldsMetadata(pctx.typeFactory()));
-
+
return cur;
}
-
- /**
- *
- */
+
private void executeFragment(UUID qryId, FragmentPlan plan, PlanningContext pctx, FragmentDescription fragmentDesc) {
ExecutionContext<RowT> ectx = new ExecutionContext<>(taskExecutor, pctx, qryId,
fragmentDesc, handler, Commons.parametersMap(pctx.parameters()));
-
+
long frId = fragmentDesc.fragmentId();
String origNodeId = pctx.originatingNodeId();
-
+
Outbox<RowT> node = new LogicalRelImplementor<>(
ectx,
affSrvc,
mailboxRegistry,
exchangeSrvc
).go(plan.root());
-
+
try {
msgSrvc.send(
origNodeId,
@@ -626,25 +544,19 @@ public class ExecutionServiceImpl<RowT> implements ExecutionService {
);
} catch (IgniteInternalCheckedException e) {
IgniteInternalException wrpEx = new IgniteInternalException("Failed to send reply. [nodeId=" + origNodeId + ']', e);
-
+
throw wrpEx;
}
-
+
node.init();
}
-
- /**
- *
- */
+
private void register(QueryInfo info) {
UUID qryId = info.ctx.queryId();
-
+
running.put(qryId, info);
}
-
- /**
- *
- */
+
private ResultSetMetadataInternal resultSetMetadata(PlanningContext ctx, RelDataType sqlType,
@Nullable List<List<String>> origins) {
return new ResultSetMetadataImpl(
@@ -652,43 +564,37 @@ public class ExecutionServiceImpl<RowT> implements ExecutionService {
origins
);
}
-
- /**
- *
- */
+
private boolean single(SqlNode sqlNode) {
return !(sqlNode instanceof SqlNodeList);
}
-
- /**
- *
- */
+
private void onMessage(String nodeId, QueryStartRequest msg) {
assert nodeId != null && msg != null;
-
+
try {
PlanningContext pctx = createContext(msg.topologyVersion(), nodeId, msg.schema(),
msg.root(), msg.parameters());
-
+
List<QueryPlan> qryPlans = qryPlanCache.queryPlan(
pctx,
new CacheKey(pctx.schemaName(), pctx.query()),
this::prepareFragment
);
-
+
assert qryPlans.size() == 1 && qryPlans.get(0).type() == QueryPlan.Type.FRAGMENT;
-
+
FragmentPlan plan = (FragmentPlan) qryPlans.get(0);
-
+
executeFragment(msg.queryId(), plan, pctx, msg.fragmentDescription());
} catch (Throwable ex) {
LOG.error("Failed to start query fragment", ex);
-
+
mailboxRegistry.outboxes(msg.queryId(), msg.fragmentId(), -1)
.forEach(Outbox::close);
mailboxRegistry.inboxes(msg.queryId(), msg.fragmentId(), -1)
.forEach(Inbox::close);
-
+
try {
msgSrvc.send(
nodeId,
@@ -700,100 +606,67 @@ public class ExecutionServiceImpl<RowT> implements ExecutionService {
);
} catch (Exception e) {
LOG.error("Error occurred during send error message", e);
-
+
IgniteInternalException wrpEx = new IgniteInternalException("Error occurred during send error message", e);
-
+
e.addSuppressed(ex);
-
+
throw wrpEx;
}
-
+
throw ex;
}
}
-
- /**
- *
- */
+
private void onMessage(String nodeId, QueryStartResponse msg) {
assert nodeId != null && msg != null;
-
+
QueryInfo info = running.get(msg.queryId());
-
+
if (info != null) {
info.onResponse(nodeId, msg.fragmentId(), msg.error());
}
}
-
- /**
- *
- */
+
private void onMessage(String nodeId, ErrorMessage msg) {
assert nodeId != null && msg != null;
-
+
QueryInfo info = running.get(msg.queryId());
-
+
if (info != null) {
info.onError(new RemoteException(nodeId, msg.queryId(), msg.fragmentId(), msg.error()));
}
}
-
- /**
- *
- */
+
private void onNodeLeft(ClusterNode node) {
running.forEach((uuid, queryInfo) -> queryInfo.onNodeLeft(node.id()));
}
-
-
+
+
/** {@inheritDoc} */
@Override
public void stop() throws Exception {
IgniteUtils.closeAll(qryPlanCache::stop, iteratorsHolder::stop, mailboxRegistry::stop, exchangeSrvc::stop);
}
-
- /**
- *
- */
+
private enum QueryState {
- /**
- *
- */
RUNNING,
-
- /**
- *
- */
+
CLOSING,
-
- /**
- *
- */
+
CLOSED
}
-
- /**
- *
- */
+
private static final class RemoteFragmentKey {
- /**
- *
- */
private final String nodeId;
-
- /**
- *
- */
+
private final long fragmentId;
-
- /**
- *
- */
+
private RemoteFragmentKey(String nodeId, long fragmentId) {
this.nodeId = nodeId;
this.fragmentId = fragmentId;
}
-
+
/** {@inheritDoc} */
@Override
public boolean equals(Object o) {
@@ -803,15 +676,15 @@ public class ExecutionServiceImpl<RowT> implements ExecutionService {
if (o == null || getClass() != o.getClass()) {
return false;
}
-
+
RemoteFragmentKey that = (RemoteFragmentKey) o;
-
+
if (fragmentId != that.fragmentId) {
return false;
}
return nodeId.equals(that.nodeId);
}
-
+
/** {@inheritDoc} */
@Override
public int hashCode() {
@@ -820,102 +693,84 @@ public class ExecutionServiceImpl<RowT> implements ExecutionService {
return res;
}
}
-
- /**
- *
- */
+
private final class QueryInfo implements Cancellable {
- /**
- *
- */
private final ExecutionContext<RowT> ctx;
-
- /**
- *
- */
+
private final RootNode<RowT> root;
-
- /** remote nodes */
+
+ /** Remote nodes. */
private final Set<String> remotes;
-
- /** node to fragment */
+
+ /** Node to fragment. */
private final Set<RemoteFragmentKey> waiting;
-
- /**
- *
- */
+
private volatile QueryState state;
-
- /**
- *
- */
+
private QueryInfo(ExecutionContext<RowT> ctx, MultiStepPlan plan, Node<RowT> root) {
this.ctx = ctx;
-
+
RootNode<RowT> rootNode = new RootNode<>(ctx, plan.metadata().rowType(), this::tryClose);
rootNode.register(root);
-
+
this.root = rootNode;
-
+
remotes = new HashSet<>();
waiting = new HashSet<>();
-
+
for (int i = 1; i < plan.fragments().size(); i++) {
Fragment fragment = plan.fragments().get(i);
List<String> nodes = plan.mapping(fragment).nodeIds();
-
+
remotes.addAll(nodes);
-
+
for (String node : nodes) {
waiting.add(new RemoteFragmentKey(node, fragment.fragmentId()));
}
}
-
+
state = QueryState.RUNNING;
}
-
- /**
- *
- */
+
public Iterator<RowT> iterator() {
return iteratorsHolder.iterator(root);
}
-
+
/** {@inheritDoc} */
@Override
public void cancel() {
root.close();
}
-
+
/**
* Can be called multiple times after receive each error at {@link #onResponse(RemoteFragmentKey, Throwable)}.
*/
private void tryClose() {
QueryState state0 = null;
-
+
synchronized (this) {
if (state == QueryState.CLOSED) {
return;
}
-
+
if (state == QueryState.RUNNING) {
state0 = state = QueryState.CLOSING;
}
-
+
// 1) close local fragment
root.closeInternal();
-
+
if (state == QueryState.CLOSING && waiting.isEmpty()) {
state0 = state = QueryState.CLOSED;
}
}
-
+
if (state0 == QueryState.CLOSED) {
// 2) unregister running query
running.remove(ctx.queryId());
-
+
IgniteInternalException wrpEx = null;
-
+
// 3) close remote fragments
for (String nodeId : remotes) {
try {
@@ -928,76 +783,64 @@ public class ExecutionServiceImpl<RowT> implements ExecutionService {
}
}
}
-
+
// 4) Cancel local fragment
root.context().execute(ctx::cancel, root::onError);
-
+
if (wrpEx != null) {
throw wrpEx;
}
}
}
-
- /**
- *
- */
+
private void onNodeLeft(String nodeId) {
List<RemoteFragmentKey> fragments = null;
-
+
synchronized (this) {
for (RemoteFragmentKey fragment : waiting) {
if (!fragment.nodeId.equals(nodeId)) {
continue;
}
-
+
if (fragments == null) {
fragments = new ArrayList<>();
}
-
+
fragments.add(fragment);
}
}
-
+
if (!nullOrEmpty(fragments)) {
IgniteInternalCheckedException ex = new IgniteInternalCheckedException(
"Failed to start query, node left. nodeId=" + nodeId);
-
+
for (RemoteFragmentKey fragment : fragments) {
onResponse(fragment, ex);
}
}
}
-
- /**
- *
- */
+
private void onResponse(String nodeId, long fragmentId, Throwable error) {
onResponse(new RemoteFragmentKey(nodeId, fragmentId), error);
}
-
- /**
- *
- */
+
private void onResponse(RemoteFragmentKey fragment, Throwable error) {
QueryState state;
synchronized (this) {
waiting.remove(fragment);
state = this.state;
}
-
+
if (error != null) {
onError(error);
} else if (state == QueryState.CLOSING) {
tryClose();
}
}
-
- /**
- *
- */
+
private void onError(Throwable error) {
root.onError(error);
-
+
tryClose();
}
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/LogicalRelImplementor.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/LogicalRelImplementor.java
index 8d4938f..3c0ed77 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/LogicalRelImplementor.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/LogicalRelImplementor.java
@@ -107,37 +107,22 @@ import org.apache.ignite.internal.processors.query.calcite.util.Commons;
*/
@SuppressWarnings("TypeMayBeWeakened")
public class LogicalRelImplementor<RowT> implements IgniteRelVisitor<Node<RowT>> {
- /**
- *
- */
- public static final String CNLJ_NOT_SUPPORTED_JOIN_ASSERTION_MSG = "only INNER and LEFT join supported by IgniteCorrelatedNestedLoop";
+ public static final String CNLJ_NOT_SUPPORTED_JOIN_ASSERTION_MSG =
+ "only INNER and LEFT join supported by IgniteCorrelatedNestedLoop";
- /**
- *
- */
private final ExecutionContext<RowT> ctx;
- /**
- *
- */
private final AffinityService affSrvc;
- /**
- *
- */
private final ExchangeService exchangeSvc;
- /**
- *
- */
private final MailboxRegistry mailboxRegistry;
- /**
- *
- */
private final ExpressionFactory<RowT> expressionFactory;
/**
+ * Constructor.
+ *
* @param ctx Root context.
* @param affSrvc Affinity service.
* @param mailboxRegistry Mailbox registry.
@@ -708,16 +693,10 @@ public class LogicalRelImplementor<RowT> implements IgniteRelVisitor<Node<RowT>>
throw new AssertionError();
}
- /**
- *
- */
private Node<RowT> visit(RelNode rel) {
return visit((IgniteRel) rel);
}
- /**
- *
- */
public <T extends Node<RowT>> T go(IgniteRel rel) {
return (T) visit(rel);
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/MailboxRegistry.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/MailboxRegistry.java
index 284aa92..3a23ccc 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/MailboxRegistry.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/MailboxRegistry.java
@@ -24,7 +24,8 @@ import org.apache.ignite.internal.processors.query.calcite.exec.rel.Outbox;
import org.jetbrains.annotations.Nullable;
/**
- *
+ * MailboxRegistry interface.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public interface MailboxRegistry extends LifecycleAware {
/**
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/MailboxRegistryImpl.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/MailboxRegistryImpl.java
index 416a2d8..fbc306b 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/MailboxRegistryImpl.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/MailboxRegistryImpl.java
@@ -34,29 +34,22 @@ import org.apache.ignite.network.TopologyService;
import org.jetbrains.annotations.Nullable;
/**
- *
+ * MailboxRegistryImpl.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class MailboxRegistryImpl implements MailboxRegistry {
- /**
- *
- */
private static final Predicate<Mailbox<?>> ALWAYS_TRUE = o -> true;
- /**
- *
- */
private final TopologyService topSrvc;
- /**
- *
- */
private final Map<MailboxKey, Outbox<?>> locals;
- /**
- *
- */
private final Map<MailboxKey, Inbox<?>> remotes;
+ /**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ */
public MailboxRegistryImpl(TopologyService topSrvc) {
this.topSrvc = topSrvc;
@@ -77,12 +70,12 @@ public class MailboxRegistryImpl implements MailboxRegistry {
return old != null ? old : inbox;
}
-
+
/** {@inheritDoc} */
@Override
public void register(Outbox<?> outbox) {
Outbox<?> res = locals.put(new MailboxKey(outbox.queryId(), outbox.exchangeId()), outbox);
-
+
assert res == null : res;
}
@@ -126,17 +119,11 @@ public class MailboxRegistryImpl implements MailboxRegistry {
.collect(Collectors.toList());
}
- /**
- *
- */
private void onNodeLeft(ClusterNode node) {
locals.values().forEach(n -> n.onNodeLeft(node.id()));
remotes.values().forEach(n -> n.onNodeLeft(node.id()));
}
- /**
- *
- */
private static Predicate<Mailbox<?>> makeFilter(@Nullable UUID qryId, long fragmentId, long exchangeId) {
Predicate<Mailbox<?>> filter = ALWAYS_TRUE;
if (qryId != null) {
@@ -165,23 +152,11 @@ public class MailboxRegistryImpl implements MailboxRegistry {
remotes.clear();
}
- /**
- *
- */
private static class MailboxKey {
- /**
- *
- */
private final UUID qryId;
- /**
- *
- */
private final long exchangeId;
- /**
- *
- */
private MailboxKey(UUID qryId, long exchangeId) {
this.qryId = qryId;
this.exchangeId = exchangeId;
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/PlannerHelper.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/PlannerHelper.java
index 5165224..1fbde54 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/PlannerHelper.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/PlannerHelper.java
@@ -50,7 +50,8 @@ import org.apache.ignite.internal.processors.query.calcite.util.HintUtils;
import org.apache.ignite.lang.IgniteLogger;
/**
- *
+ * PlannerHelper.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class PlannerHelper {
/**
@@ -61,6 +62,9 @@ public class PlannerHelper {
}
/**
+ * Optimize.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param sqlNode Sql node.
* @param planner Planner.
* @param log Logger.
@@ -112,16 +116,17 @@ public class PlannerHelper {
}
/**
- * This shuttle analyzes a relational tree and inserts an eager spool node just under the TableModify node in case latter depends upon a
- * table used to query the data for modify node to avoid the double processing of the retrieved rows.
+ * This shuttle analyzes a relational tree and inserts an eager spool node just under the TableModify node in case
+ * latter depends upon a table used to query the data for modify node to avoid the double processing of the
+ * retrieved rows.
* <p/>
* It considers two cases: <ol>
* <li>
* Modify node produces rows to insert, then a spool is required.
* </li>
* <li>
- * Modify node updates rows only, then a spool is required if 1) we are scaning an index and 2) any of the indexed column is updated by
- * modify node.
+ * Modify node updates rows only, then a spool is required if 1) we are scaning an index and 2) any of the indexed
+ * column is updated by modify node.
* </li>
* </ol>
*/
@@ -226,7 +231,7 @@ public class PlannerHelper {
}
/**
- * @return {@code true} in case {@link #modifyNode} produces any insert.
+ * Get modifyNodeInsertsData flag: {@code true} in case {@link #modifyNode} produces any insert.
*/
private boolean modifyNodeInsertsData() {
return modifyNode.isInsert(); // MERGE should be analyzed too
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/QueryTaskExecutor.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/QueryTaskExecutor.java
index 81e9632..d65ce98 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/QueryTaskExecutor.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/QueryTaskExecutor.java
@@ -21,7 +21,8 @@ import java.util.UUID;
import java.util.concurrent.CompletableFuture;
/**
- *
+ * QueryTaskExecutor interface.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public interface QueryTaskExecutor extends LifecycleAware {
/**
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/QueryTaskExecutorImpl.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/QueryTaskExecutorImpl.java
index e7fd340..9c7025b 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/QueryTaskExecutorImpl.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/QueryTaskExecutorImpl.java
@@ -25,34 +25,23 @@ import org.apache.ignite.internal.util.IgniteUtils;
import org.apache.ignite.lang.IgniteLogger;
/**
- *
+ * QueryTaskExecutorImpl.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class QueryTaskExecutorImpl implements QueryTaskExecutor, Thread.UncaughtExceptionHandler {
/** Default Ignite thread keep alive time. */
public static final long DFLT_THREAD_KEEP_ALIVE_TIME = 60_000L;
- /**
- *
- */
private static final IgniteLogger LOG = IgniteLogger.forClass(QueryTaskExecutorImpl.class);
- /**
- *
- */
private final String nodeName;
- /**
- *
- */
private volatile StripedThreadPoolExecutor stripedThreadPoolExecutor;
- /**
- *
- */
private Thread.UncaughtExceptionHandler exHnd;
/**
- * @param nodeName Node name.
+ * Set node name.
*/
public QueryTaskExecutorImpl(String nodeName) {
this.nodeName = nodeName;
@@ -71,6 +60,9 @@ public class QueryTaskExecutorImpl implements QueryTaskExecutor, Thread.Uncaught
}
/**
+ * ExceptionHandler.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param exHnd Uncaught exception handler.
*/
public void exceptionHandler(Thread.UncaughtExceptionHandler exHnd) {
@@ -113,9 +105,6 @@ public class QueryTaskExecutorImpl implements QueryTaskExecutor, Thread.Uncaught
}
}
- /**
- *
- */
private static int hash(UUID qryId, long fragmentId) {
// inlined Objects.hash(...)
return IgniteUtils.safeAbs(31 * (31 + (qryId != null ? qryId.hashCode() : 0)) + Long.hashCode(fragmentId));
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/RowHandler.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/RowHandler.java
index b61f60d..ac978ea 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/RowHandler.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/RowHandler.java
@@ -27,33 +27,19 @@ import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactor
* Universal accessor and mutator for rows. It also has factory methods.
*/
public interface RowHandler<RowT> {
- /**
- *
- */
Object get(int field, RowT row);
- /**
- *
- */
void set(int field, RowT row, Object val);
- /**
- *
- */
RowT concat(RowT left, RowT right);
- /**
- *
- */
int columnCount(RowT row);
- /**
- *
- */
String toString(RowT row);
/**
- *
+ * Factory.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
default RowFactory<RowT> factory(IgniteTypeFactory typeFactory, RelDataType rowType) {
if (rowType.isStruct()) {
@@ -64,7 +50,8 @@ public interface RowHandler<RowT> {
}
/**
- *
+ * Factory.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
default RowFactory<RowT> factory(IgniteTypeFactory typeFactory, List<RelDataType> fieldTypes) {
Type[] types = new Type[fieldTypes.size()];
@@ -77,21 +64,16 @@ public interface RowHandler<RowT> {
RowFactory<RowT> factory(Type... types);
+ /**
+ * RowFactory interface.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ */
@SuppressWarnings("PublicInnerClass")
interface RowFactory<RowT> {
- /**
- *
- */
RowHandler<RowT> handler();
- /**
- *
- */
RowT create();
- /**
- *
- */
RowT create(Object... fields);
}
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/RuntimeHashIndex.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/RuntimeHashIndex.java
index b873f75..3a775ea 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/RuntimeHashIndex.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/RuntimeHashIndex.java
@@ -33,21 +33,16 @@ import org.jetbrains.annotations.NotNull;
* Runtime hash index based on on-heap hash map.
*/
public class RuntimeHashIndex<RowT> implements RuntimeIndex<RowT> {
- /**
- *
- */
protected final ExecutionContext<RowT> ectx;
- /**
- *
- */
private final ImmutableBitSet keys;
/** Rows. */
private HashMap<GroupKey, List<RowT>> rows;
/**
- *
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public RuntimeHashIndex(
ExecutionContext<RowT> ectx,
@@ -69,24 +64,15 @@ public class RuntimeHashIndex<RowT> implements RuntimeIndex<RowT> {
eqRows.add(r);
}
- /**
- *
- */
@Override
public void close() {
rows.clear();
}
- /**
- *
- */
public Iterable<RowT> scan(Supplier<RowT> searchRow) {
return new IndexScan(searchRow);
}
- /**
- *
- */
private GroupKey key(RowT r) {
GroupKey.Builder b = GroupKey.builder(keys.cardinality());
@@ -97,14 +83,14 @@ public class RuntimeHashIndex<RowT> implements RuntimeIndex<RowT> {
return b.build();
}
- /**
- *
- */
private class IndexScan implements Iterable<RowT>, AutoCloseable {
/** Search row. */
private final Supplier<RowT> searchRow;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param searchRow Search row.
*/
IndexScan(Supplier<RowT> searchRow) {
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/RuntimeTreeIndex.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/RuntimeTreeIndex.java
index e14d1ce..a305ef0 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/RuntimeTreeIndex.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/RuntimeTreeIndex.java
@@ -40,14 +40,8 @@ import org.jetbrains.annotations.NotNull;
* Runtime sorted index based on on-heap tree.
*/
public class RuntimeTreeIndex<RowT> implements RuntimeIndex<RowT>, TreeIndex<RowT> {
- /**
- *
- */
protected final ExecutionContext<RowT> ectx;
- /**
- *
- */
protected final Comparator<RowT> comp;
/** Collation. */
@@ -57,7 +51,8 @@ public class RuntimeTreeIndex<RowT> implements RuntimeIndex<RowT>, TreeIndex<Row
private TreeMap<RowT, List<RowT>> rows;
/**
- *
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public RuntimeTreeIndex(
ExecutionContext<RowT> ectx,
@@ -122,9 +117,6 @@ public class RuntimeTreeIndex<RowT> implements RuntimeIndex<RowT>, TreeIndex<Row
return new IndexScan(rowType, this, filter, lowerBound, upperBound);
}
- /**
- *
- */
private class CursorImpl implements Cursor<RowT> {
/** Sub map iterator. */
private final Iterator<Map.Entry<RowT, List<RowT>>> mapIt;
@@ -132,14 +124,8 @@ public class RuntimeTreeIndex<RowT> implements RuntimeIndex<RowT>, TreeIndex<Row
/** Iterator over rows with equal index keys. */
private Iterator<RowT> listIt;
- /**
- *
- */
private RowT row;
- /**
- *
- */
CursorImpl(SortedMap<RowT, List<RowT>> subMap) {
mapIt = subMap.entrySet().iterator();
listIt = null;
@@ -163,9 +149,6 @@ public class RuntimeTreeIndex<RowT> implements RuntimeIndex<RowT>, TreeIndex<Row
return listIt != null && listIt.hasNext() || mapIt.hasNext();
}
- /**
- *
- */
private void advance() {
if (listIt == null || !listIt.hasNext()) {
listIt = mapIt.next().getValue().iterator();
@@ -185,11 +168,10 @@ public class RuntimeTreeIndex<RowT> implements RuntimeIndex<RowT>, TreeIndex<Row
}
}
- /**
- *
- */
private class IndexScan extends AbstractIndexScan<RowT, RowT> {
/**
+ * Constructor.
+ *
* @param rowType Row type.
* @param idx Physical index.
* @param filter Additional filters.
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/TableFunctionScan.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/TableFunctionScan.java
index fb5393a..02631d7 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/TableFunctionScan.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/TableFunctionScan.java
@@ -24,21 +24,17 @@ import org.apache.ignite.internal.processors.query.calcite.util.TransformingIter
import org.jetbrains.annotations.NotNull;
/**
- *
+ * TableFunctionScan.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class TableFunctionScan<RowT> implements Iterable<RowT> {
- /**
- *
- */
private final Supplier<Iterable<Object[]>> dataSupplier;
- /**
- *
- */
private final RowFactory<RowT> rowFactory;
/**
- *
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public TableFunctionScan(
Supplier<Iterable<Object[]>> dataSupplier,
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ConverterUtils.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ConverterUtils.java
index 65449e0..a3e8ed8 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ConverterUtils.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ConverterUtils.java
@@ -37,18 +37,16 @@ import org.apache.calcite.util.BuiltInMethod;
import org.apache.calcite.util.Util;
/**
- *
+ * ConverterUtils.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class ConverterUtils {
- /**
- *
- */
private ConverterUtils() {
}
/**
- * In Calcite, {@code java.sql.Date} and {@code java.sql.Time} are stored as {@code Integer} type, {@code java.sql.Timestamp} is stored
- * as {@code Long} type.
+ * In Calcite, {@code java.sql.Date} and {@code java.sql.Time} are stored as {@code Integer} type,
+ * {@code java.sql.Timestamp} is stored as {@code Long} type.
*
* @param operand Operand that should be converted.
* @param targetType Required type.
@@ -58,16 +56,10 @@ public class ConverterUtils {
return toInternal(operand, operand.getType(), targetType);
}
- /**
- *
- */
private static Type toInternal(RelDataType type) {
return toInternal(type, false);
}
- /**
- *
- */
private static Expression toInternal(Expression operand,
Type fromType, Type targetType) {
if (fromType == java.sql.Date.class) {
@@ -92,9 +84,6 @@ public class ConverterUtils {
return operand;
}
- /**
- *
- */
static Type toInternal(RelDataType type, boolean forceNotNull) {
switch (type.getSqlTypeName()) {
case DATE:
@@ -108,16 +97,13 @@ public class ConverterUtils {
}
/**
- * Converts from internal representation to JDBC representation used by arguments of user-defined functions. For example, converts date
- * values from {@code int} to {@link java.sql.Date}.
+ * Converts from internal representation to JDBC representation used by arguments of user-defined functions.
+ * For example, converts date values from {@code int} to {@link java.sql.Date}.
*/
private static Expression fromInternal(Expression operand, Type targetType) {
return fromInternal(operand, operand.getType(), targetType);
}
- /**
- *
- */
private static Expression fromInternal(Expression operand,
Type fromType, Type targetType) {
if (operand == ConstantUntypedNull.INSTANCE) {
@@ -157,9 +143,6 @@ public class ConverterUtils {
return operand;
}
- /**
- *
- */
static List<Expression> fromInternal(Class<?>[] targetTypes,
List<Expression> expressions) {
final List<Expression> list = new ArrayList<>();
@@ -184,9 +167,6 @@ public class ConverterUtils {
return list;
}
- /**
- *
- */
static List<Type> internalTypes(List<? extends RexNode> operandList) {
return Util.transform(operandList, node -> toInternal(node.getType()));
}
@@ -194,9 +174,9 @@ public class ConverterUtils {
/**
* Convert {@code operand} to target type {@code toType}.
*
- * @param operand The expression to convert
- * @param toType Target type
- * @return A new expression with type {@code toType} or original if there is no need to convert
+ * @param operand The expression to convert.
+ * @param toType Target type.
+ * @return A new expression with type {@code toType} or original if there is no need to convert.
*/
public static Expression convert(Expression operand, Type toType) {
final Type fromType = operand.getType();
@@ -206,10 +186,10 @@ public class ConverterUtils {
/**
* Convert {@code operand} to target type {@code toType}.
*
- * @param operand The expression to convert
- * @param fromType Field type
- * @param toType Target type
- * @return A new expression with type {@code toType} or original if there is no need to convert
+ * @param operand The expression to convert.
+ * @param fromType Field type.
+ * @param toType Target type.
+ * @return A new expression with type {@code toType} or original if there is no need to convert.
*/
public static Expression convert(Expression operand, Type fromType, Type toType) {
if (!Types.needTypeCast(fromType, toType)) {
@@ -418,17 +398,11 @@ public class ConverterUtils {
return Expressions.convert_(operand, toType);
}
- /**
- *
- */
private static boolean isA(Type fromType, Primitive primitive) {
return Primitive.of(fromType) == primitive
|| Primitive.ofBox(fromType) == primitive;
}
- /**
- *
- */
private static boolean representAsInternalType(Type type) {
return type == java.sql.Date.class
|| type == java.sql.Time.class
@@ -436,19 +410,20 @@ public class ConverterUtils {
}
/**
- * In {@link org.apache.calcite.sql.type.SqlTypeAssignmentRule}, some rules decide whether one type can be assignable to another type.
+ * In {@link org.apache.calcite.sql.type.SqlTypeAssignmentRule}, some rules decide whether one type can be
+ * assignable to another type.
* Based on these rules, a function can accept arguments with assignable types.
*
* <p>For example, a function with Long type operand can accept Integer as input.
* See {@code org.apache.calcite.sql.SqlUtil#filterRoutinesByParameterType()} for details.
*
* <p>During query execution, some of the assignable types need explicit conversion
- * to the target types. i.e., Decimal expression should be converted to Integer before it is assigned to the Integer type Lvalue(In
- * Java, Decimal can not be assigned to Integer directly).
+ * to the target types. i.e., Decimal expression should be converted to Integer before it is assigned to the Integer
+ * type Lvalue(In Java, Decimal can not be assigned to Integer directly).
*
- * @param targetTypes Formal operand types declared for the function arguments
- * @param arguments Input expressions to the function
- * @return Input expressions with probable type conversion
+ * @param targetTypes Formal operand types declared for the function arguments.
+ * @param arguments Input expressions to the function.
+ * @return Input expressions with probable type conversion.
*/
static List<Expression> convertAssignableTypes(Class<?>[] targetTypes,
List<Expression> arguments) {
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ExpressionFactory.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ExpressionFactory.java
index 6f07947..de29553 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ExpressionFactory.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ExpressionFactory.java
@@ -35,9 +35,6 @@ import org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.Aggregat
* Expression factory.
*/
public interface ExpressionFactory<RowT> {
- /**
- *
- */
Supplier<List<AccumulatorWrapper<RowT>>> accumulatorsFactory(
AggregateType type,
List<AggregateCall> calls,
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ExpressionFactoryImpl.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ExpressionFactoryImpl.java
index 6f7bad5..f2694a0 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ExpressionFactoryImpl.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ExpressionFactoryImpl.java
@@ -68,50 +68,30 @@ import org.apache.ignite.internal.processors.query.calcite.util.IgniteMethod;
import org.apache.ignite.internal.processors.query.calcite.util.Primitives;
/**
- * Implements rex expression into a function object. Uses JaninoRexCompiler under the hood. Each expression compiles into a class and a
- * wrapper over it is returned.
+ * Implements rex expression into a function object. Uses JaninoRexCompiler under the hood. Each expression compiles
+ * into a class and a wrapper over it is returned.
*/
public class ExpressionFactoryImpl<RowT> implements ExpressionFactory<RowT> {
- /**
- *
- */
private static final int CACHE_SIZE = 1024;
- /**
- *
- */
private static final ConcurrentMap<String, Scalar> SCALAR_CACHE = Caffeine.newBuilder()
.maximumSize(CACHE_SIZE)
.<String, Scalar>build()
.asMap();
- /**
- *
- */
private final IgniteTypeFactory typeFactory;
- /**
- *
- */
private final SqlConformance conformance;
- /**
- *
- */
private final RexBuilder rexBuilder;
- /**
- *
- */
private final RelDataType emptyType;
- /**
- *
- */
private final ExecutionContext<RowT> ctx;
/**
- *
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public ExpressionFactoryImpl(ExecutionContext<RowT> ctx, IgniteTypeFactory typeFactory, SqlConformance conformance) {
this.ctx = ctx;
@@ -168,9 +148,6 @@ public class ExpressionFactoryImpl<RowT> implements ExpressionFactory<RowT> {
return Commons.compoundComparator(comparators);
}
- /**
- *
- */
@SuppressWarnings("rawtypes")
private Comparator<RowT> comparator(RelFieldCollation fieldCollation) {
final int nullComparison = fieldCollation.nullDirection.nullComparison;
@@ -192,9 +169,6 @@ public class ExpressionFactoryImpl<RowT> implements ExpressionFactory<RowT> {
};
}
- /**
- *
- */
@SuppressWarnings("rawtypes")
private Comparator<RowT> comparator(RelFieldCollation left, RelFieldCollation right) {
final int nullComparison = left.nullDirection.nullComparison;
@@ -287,9 +261,6 @@ public class ExpressionFactoryImpl<RowT> implements ExpressionFactory<RowT> {
return SCALAR_CACHE.computeIfAbsent(digest(nodes, type), k -> compile(nodes, type));
}
- /**
- *
- */
private Scalar compile(Iterable<RexNode> nodes, RelDataType type) {
if (type == null) {
type = emptyType;
@@ -343,9 +314,6 @@ public class ExpressionFactoryImpl<RowT> implements ExpressionFactory<RowT> {
return Commons.compile(Scalar.class, Expressions.toString(List.of(decl), "\n", false));
}
- /**
- *
- */
private String digest(List<RexNode> nodes, RelDataType type) {
StringBuilder b = new StringBuilder();
@@ -368,26 +336,16 @@ public class ExpressionFactoryImpl<RowT> implements ExpressionFactory<RowT> {
return b.toString();
}
- /**
- *
- */
private class PredicateImpl implements Predicate<RowT> {
- /**
- *
- */
private final Scalar scalar;
- /**
- *
- */
private final RowT out;
- /**
- *
- */
private final RowHandler<RowT> handler;
/**
+ * Constructor.
+ *
* @param scalar Scalar.
*/
private PredicateImpl(Scalar scalar) {
@@ -405,21 +363,14 @@ public class ExpressionFactoryImpl<RowT> implements ExpressionFactory<RowT> {
}
}
- /**
- *
- */
private class ProjectImpl implements Function<RowT, RowT> {
- /**
- *
- */
private final Scalar scalar;
- /**
- *
- */
private final RowFactory<RowT> factory;
/**
+ * Constructor.
+ *
* @param scalar Scalar.
* @param factory Row factory.
*/
@@ -438,22 +389,13 @@ public class ExpressionFactoryImpl<RowT> implements ExpressionFactory<RowT> {
}
}
- /**
- *
- */
private class ValuesImpl implements Supplier<RowT> {
- /**
- *
- */
private final Scalar scalar;
- /**
- *
- */
private final RowFactory<RowT> factory;
/**
- *
+ * Constructor.
*/
private ValuesImpl(Scalar scalar, RowFactory<RowT> factory) {
this.scalar = scalar;
@@ -470,22 +412,13 @@ public class ExpressionFactoryImpl<RowT> implements ExpressionFactory<RowT> {
}
}
- /**
- *
- */
private class ValueImpl<T> implements Supplier<T> {
- /**
- *
- */
private final Scalar scalar;
- /**
- *
- */
private final RowFactory<RowT> factory;
/**
- *
+ * Constructor.
*/
private ValueImpl(Scalar scalar, RowFactory<RowT> factory) {
this.scalar = scalar;
@@ -502,28 +435,13 @@ public class ExpressionFactoryImpl<RowT> implements ExpressionFactory<RowT> {
}
}
- /**
- *
- */
private class FieldGetter implements InputGetter {
- /**
- *
- */
private final Expression hnd;
- /**
- *
- */
private final Expression row;
- /**
- *
- */
private final RelDataType rowType;
- /**
- *
- */
private FieldGetter(Expression hnd, Expression row, RelDataType rowType) {
this.hnd = hnd;
this.row = row;
@@ -554,42 +472,21 @@ public class ExpressionFactoryImpl<RowT> implements ExpressionFactory<RowT> {
}
}
- /**
- *
- */
private class CorrelatesBuilder extends RexShuttle {
- /**
- *
- */
private final BlockBuilder builder;
- /**
- *
- */
private final Expression ctx;
- /**
- *
- */
private final Expression hnd;
- /**
- *
- */
private Map<String, FieldGetter> correlates;
- /**
- *
- */
private CorrelatesBuilder(BlockBuilder builder, Expression ctx, Expression hnd) {
this.builder = builder;
this.hnd = hnd;
this.ctx = ctx;
}
- /**
- *
- */
public Function1<String, InputGetter> build(Iterable<RexNode> nodes) {
try {
for (RexNode node : nodes) {
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/IgniteBuiltInMethod.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/IgniteBuiltInMethod.java
index 3628c6e..2acf768 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/IgniteBuiltInMethod.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/IgniteBuiltInMethod.java
@@ -24,24 +24,12 @@ import org.apache.calcite.linq4j.tree.Types;
* Built-in methods.
*/
public enum IgniteBuiltInMethod {
- /**
- *
- */
SYSTEM_RANGE2(IgniteSqlFunctions.class, "systemRange", Object.class, Object.class),
- /**
- *
- */
SYSTEM_RANGE3(IgniteSqlFunctions.class, "systemRange", Object.class, Object.class, Object.class);
- /**
- *
- */
public final Method method;
- /**
- *
- */
IgniteBuiltInMethod(Method method) {
this.method = method;
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/IgniteSqlFunctions.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/IgniteSqlFunctions.java
index f3c2bc8..ab5407e 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/IgniteSqlFunctions.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/IgniteSqlFunctions.java
@@ -54,9 +54,6 @@ public class IgniteSqlFunctions {
return new RangeTable(rangeStart, rangeEnd, increment);
}
- /**
- *
- */
private static class RangeTable implements ScannableTable {
/** Start of the range. */
private final Object rangeStart;
@@ -68,10 +65,11 @@ public class IgniteSqlFunctions {
private final Object increment;
/**
- * Note: {@code Object} arguments required here due to: 1. {@code NULL} arguments need to be supported, so we can't use {@code long}
- * arguments type. 2. {@code Integer} and other numeric classes can be converted to {@code long} type by java, but can't be
- * converted to {@code Long} type, so we can't use {@code Long} arguments type either. Instead, we accept {@code Object} arguments
- * type and try to convert valid types to {@code long}.
+ * Note: {@code Object} arguments required here due to: 1. {@code NULL} arguments need to be supported, so we
+ * can't use {@code long} arguments type. 2. {@code Integer} and other numeric classes can be converted to
+ * {@code long} type by java, but can't be converted to {@code Long} type, so we can't use {@code Long}
+ * arguments type either. Instead, we accept {@code Object} arguments type and try to convert valid types to
+ * {@code long}.
*/
RangeTable(Object rangeStart, Object rangeEnd, Object increment) {
this.rangeStart = rangeStart;
@@ -132,9 +130,6 @@ public class IgniteSqlFunctions {
};
}
- /**
- *
- */
private long convertToLongArg(Object val, String name) {
if (val instanceof Byte || val instanceof Short || val instanceof Integer || val instanceof Long) {
return ((Number) val).longValue();
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ReflectiveCallNotNullImplementor.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ReflectiveCallNotNullImplementor.java
index 1f1cd48..7167938 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ReflectiveCallNotNullImplementor.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/ReflectiveCallNotNullImplementor.java
@@ -31,9 +31,6 @@ import org.apache.calcite.rex.RexCall;
* created.
*/
public class ReflectiveCallNotNullImplementor implements NotNullImplementor {
- /**
- *
- */
protected final Method method;
/**
@@ -70,9 +67,6 @@ public class ReflectiveCallNotNullImplementor implements NotNullImplementor {
return translator.handleMethodCheckedExceptions(callExpr);
}
- /**
- *
- */
private boolean containsCheckedException(Method method) {
Class[] exceptions = method.getExceptionTypes();
if (exceptions == null || exceptions.length == 0) {
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/RexImpTable.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/RexImpTable.java
index 421ec7a..c251f29 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/RexImpTable.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/RexImpTable.java
@@ -257,43 +257,23 @@ import org.apache.ignite.internal.processors.query.calcite.util.IgniteMethod;
* Contains implementations of Rex operators as Java code.
*/
public class RexImpTable {
- /**
- *
- */
public static final RexImpTable INSTANCE = new RexImpTable();
- /**
- *
- */
public static final ConstantExpression NULL_EXPR = Expressions.constant(null);
- /**
- *
- */
public static final ConstantExpression FALSE_EXPR = Expressions.constant(false);
- /**
- *
- */
public static final ConstantExpression TRUE_EXPR = Expressions.constant(true);
- /**
- *
- */
public static final MemberExpression BOXED_FALSE_EXPR = Expressions.field(null, Boolean.class, "FALSE");
- /**
- *
- */
public static final MemberExpression BOXED_TRUE_EXPR = Expressions.field(null, Boolean.class, "TRUE");
- /**
- *
- */
private final Map<SqlOperator, RexCallImplementor> map = new HashMap<>();
/**
- *
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
RexImpTable() {
defineMethod(ROW, BuiltInMethod.ARRAY.method, NullPolicy.NONE);
@@ -570,9 +550,6 @@ public class RexImpTable {
map.put(LOCALTIMESTAMP, systemFunctionImplementor);
}
- /**
- *
- */
private <T> Supplier<T> constructorSupplier(Class<T> klass) {
final Constructor<T> constructor;
try {
@@ -592,31 +569,19 @@ public class RexImpTable {
};
}
- /**
- *
- */
private void defineMethod(SqlOperator operator, String functionName, NullPolicy nullPolicy) {
map.put(operator, new MethodNameImplementor(functionName, nullPolicy, false));
}
- /**
- *
- */
private void defineMethod(SqlOperator operator, Method method, NullPolicy nullPolicy) {
map.put(operator, new MethodImplementor(method, nullPolicy, false));
}
- /**
- *
- */
private void defineUnary(SqlOperator operator, ExpressionType expressionType,
NullPolicy nullPolicy, String backupMethodName) {
map.put(operator, new UnaryImplementor(expressionType, nullPolicy, backupMethodName));
}
- /**
- *
- */
private void defineBinary(SqlOperator operator, ExpressionType expressionType,
NullPolicy nullPolicy, String backupMethodName) {
map.put(operator,
@@ -624,9 +589,6 @@ public class RexImpTable {
backupMethodName));
}
- /**
- *
- */
private static RexCallImplementor wrapAsRexCallImplementor(
final CallImplementor implementor) {
return new AbstractRexCallImplementor(NullPolicy.NONE, false) {
@@ -644,7 +606,8 @@ public class RexImpTable {
}
/**
- *
+ * Get.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public RexCallImplementor get(final SqlOperator operator) {
if (operator instanceof SqlUserDefinedFunction) {
@@ -663,16 +626,10 @@ public class RexImpTable {
return map.get(operator);
}
- /**
- *
- */
static Expression optimize(Expression expression) {
return expression.accept(new OptimizeShuttle());
}
- /**
- *
- */
static Expression optimize2(Expression operand, Expression expression) {
if (Primitive.is(operand.getType())) {
// Primitive values cannot be null
@@ -686,9 +643,6 @@ public class RexImpTable {
expression));
}
- /**
- *
- */
private static RelDataType toSql(RelDataTypeFactory typeFactory,
RelDataType type) {
if (type instanceof RelDataTypeFactoryImpl.JavaType) {
@@ -702,9 +656,6 @@ public class RexImpTable {
return type;
}
- /**
- *
- */
private static <E> boolean allSame(List<E> list) {
E prev = null;
for (E e : list) {
@@ -737,9 +688,9 @@ public class RexImpTable {
TRUE,
/**
- * It is not possible for any of the arguments to be null. If the argument type is nullable, the enclosing code will already have
- * performed a not-null check. This may allow the operator implementor to generate a more efficient implementation, for example, by
- * avoiding boxing or unboxing.
+ * It is not possible for any of the arguments to be null. If the argument type is nullable, the enclosing code
+ * will already have performed a not-null check. This may allow the operator implementor to generate a more
+ * efficient implementation, for example, by avoiding boxing or unboxing.
*/
NOT_POSSIBLE,
@@ -803,9 +754,6 @@ public class RexImpTable {
}
}
- /**
- *
- */
static Expression getDefaultValue(Type type) {
if (Primitive.is(type)) {
Primitive p = Primitive.of(type);
@@ -846,9 +794,6 @@ public class RexImpTable {
/** Implementor for the {@code TRIM} function. */
private static class TrimImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
TrimImplementor() {
super(NullPolicy.STRICT, false);
}
@@ -881,22 +826,17 @@ public class RexImpTable {
}
/**
- * Implementor for the {@code MONTHNAME} and {@code DAYNAME} functions. Each takes a {@link java.util.Locale} argument.
+ * Implementor for the {@code MONTHNAME} and {@code DAYNAME} functions. Each takes a {@link java.util.Locale}
+ * argument.
*/
private static class PeriodNameImplementor extends MethodNameImplementor {
- /**
- *
- */
+
private final BuiltInMethod timestampMethod;
- /**
- *
- */
+
private final BuiltInMethod dateMethod;
- /**
- *
- */
+
PeriodNameImplementor(String methodName, BuiltInMethod timestampMethod,
BuiltInMethod dateMethod) {
super(methodName, NullPolicy.STRICT, false);
@@ -926,9 +866,6 @@ public class RexImpTable {
}
}
- /**
- *
- */
protected Expression getExpression(RexToLixTranslator translator,
Expression operand, BuiltInMethod builtInMethod) {
final MethodCallExpression locale =
@@ -940,19 +877,10 @@ public class RexImpTable {
/** Implementor for the {@code FLOOR} and {@code CEIL} functions. */
private static class FloorImplementor extends MethodNameImplementor {
- /**
- *
- */
final Method timestampMethod;
- /**
- *
- */
final Method dateMethod;
- /**
- *
- */
FloorImplementor(String methodName, Method timestampMethod, Method dateMethod) {
super(methodName, NullPolicy.STRICT, false);
this.timestampMethod = timestampMethod;
@@ -1025,9 +953,6 @@ public class RexImpTable {
}
}
- /**
- *
- */
private Expression call(Expression operand, Type type,
TimeUnit timeUnit) {
return Expressions.call(SqlFunctions.class, methodName,
@@ -1039,14 +964,8 @@ public class RexImpTable {
/** Implementor for a function that generates calls to a given method. */
private static class MethodImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
protected final Method method;
- /**
- *
- */
MethodImplementor(Method method, NullPolicy nullPolicy, boolean harmonize) {
super(nullPolicy, harmonize);
this.method = method;
@@ -1082,9 +1001,6 @@ public class RexImpTable {
* variable arguments function.
*/
private static class JsonValueImplementor extends MethodImplementor {
- /**
- *
- */
JsonValueImplementor(Method method) {
super(method, NullPolicy.ARG0, false);
}
@@ -1151,14 +1067,8 @@ public class RexImpTable {
* is overloaded; then you can use one implementor for several overloads.
*/
private static class MethodNameImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
protected final String methodName;
- /**
- *
- */
MethodNameImplementor(String methodName,
NullPolicy nullPolicy, boolean harmonize) {
super(nullPolicy, harmonize);
@@ -1198,9 +1108,6 @@ public class RexImpTable {
Primitive.FLOAT,
Primitive.DOUBLE);
- /**
- *
- */
private static final List<SqlBinaryOperator> COMPARISON_OPERATORS =
List.of(
SqlStdOperatorTable.LESS_THAN,
@@ -1208,32 +1115,17 @@ public class RexImpTable {
SqlStdOperatorTable.GREATER_THAN,
SqlStdOperatorTable.GREATER_THAN_OR_EQUAL);
- /**
- *
- */
private static final List<SqlBinaryOperator> EQUALS_OPERATORS =
List.of(
SqlStdOperatorTable.EQUALS,
SqlStdOperatorTable.NOT_EQUALS);
- /**
- *
- */
public static final String METHOD_POSTFIX_FOR_ANY_TYPE = "Any";
- /**
- *
- */
private final ExpressionType expressionType;
- /**
- *
- */
private final String backupMethodName;
- /**
- *
- */
BinaryImplementor(NullPolicy nullPolicy, boolean harmonize,
ExpressionType expressionType, String backupMethodName) {
super(nullPolicy, harmonize);
@@ -1314,9 +1206,6 @@ public class RexImpTable {
return false;
}
- /**
- *
- */
private Expression callBackupMethodAnyType(List<Expression> expressions) {
final String backupMethodNameForAnyType =
backupMethodName + METHOD_POSTFIX_FOR_ANY_TYPE;
@@ -1328,9 +1217,6 @@ public class RexImpTable {
expression0, expression1);
}
- /**
- *
- */
private Expression maybeBox(Expression expression) {
final Primitive primitive = Primitive.of(expression.getType());
if (primitive != null) {
@@ -1343,19 +1229,10 @@ public class RexImpTable {
/** Implementor for unary operators. */
private static class UnaryImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
private final ExpressionType expressionType;
- /**
- *
- */
private final String backupMethodName;
- /**
- *
- */
UnaryImplementor(ExpressionType expressionType, NullPolicy nullPolicy,
String backupMethodName) {
super(nullPolicy, false);
@@ -1397,9 +1274,6 @@ public class RexImpTable {
/** Implementor for the {@code EXTRACT(unit FROM datetime)} function. */
private static class ExtractImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
ExtractImplementor() {
super(NullPolicy.STRICT, false);
}
@@ -1541,9 +1415,6 @@ public class RexImpTable {
}
}
- /**
- *
- */
private static Expression mod(Expression operand, long factor) {
if (factor == 1L) {
return operand;
@@ -1553,9 +1424,6 @@ public class RexImpTable {
}
}
- /**
- *
- */
private static long getFactor(TimeUnit unit) {
switch (unit) {
case DAY:
@@ -1584,9 +1452,6 @@ public class RexImpTable {
/** Implementor for the SQL {@code COALESCE} operator. */
private static class CoalesceImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
CoalesceImplementor() {
super(NullPolicy.NONE, false);
}
@@ -1604,9 +1469,6 @@ public class RexImpTable {
return implementRecurse(translator, argValueList);
}
- /**
- *
- */
private Expression implementRecurse(RexToLixTranslator translator,
final List<Expression> argValueList) {
if (argValueList.size() == 1) {
@@ -1622,9 +1484,6 @@ public class RexImpTable {
/** Implementor for the SQL {@code CAST} operator. */
private static class CastImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
CastImplementor() {
super(NullPolicy.STRICT, false);
}
@@ -1661,9 +1520,6 @@ public class RexImpTable {
targetType, argValueList.get(0));
}
- /**
- *
- */
private RelDataType nullifyType(JavaTypeFactory typeFactory,
final RelDataType type, final boolean nullable) {
if (type instanceof RelDataTypeFactoryImpl.JavaType) {
@@ -1679,9 +1535,6 @@ public class RexImpTable {
/** Implementor for the {@code REINTERPRET} internal SQL operator. */
private static class ReinterpretImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
ReinterpretImplementor() {
super(NullPolicy.STRICT, false);
}
@@ -1705,9 +1558,6 @@ public class RexImpTable {
private static class ValueConstructorImplementor
extends AbstractRexCallImplementor {
- /**
- *
- */
ValueConstructorImplementor() {
super(NullPolicy.NONE, false);
}
@@ -1757,9 +1607,6 @@ public class RexImpTable {
/** Implementor for the {@code ITEM} SQL operator. */
private static class ItemImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
ItemImplementor() {
super(NullPolicy.STRICT, false);
}
@@ -1784,9 +1631,6 @@ public class RexImpTable {
return implementor.implementSafe(translator, call, argValueList);
}
- /**
- *
- */
private MethodImplementor getImplementor(SqlTypeName sqlTypeName) {
switch (sqlTypeName) {
case ARRAY:
@@ -1805,11 +1649,7 @@ public class RexImpTable {
* <p>Several of these are represented internally as constant values, set
* per execution.
*/
- private static class SystemFunctionImplementor
- extends AbstractRexCallImplementor {
- /**
- *
- */
+ private static class SystemFunctionImplementor extends AbstractRexCallImplementor {
SystemFunctionImplementor() {
super(NullPolicy.NONE, false);
}
@@ -1866,22 +1706,13 @@ public class RexImpTable {
/** Implementor for the {@code NOT} operator. */
private static class NotImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
private AbstractRexCallImplementor implementor;
- /**
- *
- */
private NotImplementor(AbstractRexCallImplementor implementor) {
super(null, false);
this.implementor = implementor;
}
- /**
- *
- */
static AbstractRexCallImplementor of(AbstractRexCallImplementor implementor) {
return new NotImplementor(implementor);
}
@@ -1905,9 +1736,6 @@ public class RexImpTable {
/** Implementor for various datetime arithmetic. */
private static class DatetimeArithmeticImplementor
extends AbstractRexCallImplementor {
- /**
- *
- */
DatetimeArithmeticImplementor() {
super(NullPolicy.STRICT, false);
}
@@ -2043,9 +1871,6 @@ public class RexImpTable {
/** Null-safe implementor of {@code RexCall}s. */
public interface RexCallImplementor {
- /**
- *
- */
RexToLixTranslator.Result implement(
RexToLixTranslator translator,
RexCall call,
@@ -2066,21 +1891,11 @@ public class RexImpTable {
* </code>
* </blockquote>
*/
- private abstract static class AbstractRexCallImplementor
- implements RexCallImplementor {
- /**
- *
- */
+ private abstract static class AbstractRexCallImplementor implements RexCallImplementor {
final NullPolicy nullPolicy;
- /**
- *
- */
private final boolean harmonize;
- /**
- *
- */
AbstractRexCallImplementor(NullPolicy nullPolicy, boolean harmonize) {
this.nullPolicy = nullPolicy;
this.harmonize = harmonize;
@@ -2106,9 +1921,6 @@ public class RexImpTable {
return new RexToLixTranslator.Result(isNullVariable, valueVariable);
}
- /**
- *
- */
// Variable name facilitates reasoning about issues when necessary
abstract String getVariableName();
@@ -2127,9 +1939,6 @@ public class RexImpTable {
return Expressions.foldOr(argIsNullList);
}
- /**
- *
- */
// E.g., "final Integer xxx_value = (a_isNull || b_isNull) ? null : plus(a, b)"
private ParameterExpression genValueStatement(
final RexToLixTranslator translator,
@@ -2173,16 +1982,10 @@ public class RexImpTable {
return value;
}
- /**
- *
- */
Expression getIfTrue(Type type) {
return getDefaultValue(type);
}
- /**
- *
- */
// E.g., "final boolean xxx_isNull = xxx_value == null"
private ParameterExpression genIsNullStatement(
final RexToLixTranslator translator, final ParameterExpression value) {
@@ -2254,9 +2057,6 @@ public class RexImpTable {
return unboxValueList;
}
- /**
- *
- */
private Expression unboxExpression(final Expression argValue) {
Primitive fromBox = Primitive.ofBox(argValue.getType());
if (fromBox == null || fromBox == Primitive.VOID) {
@@ -2277,9 +2077,6 @@ public class RexImpTable {
return NullAs.NOT_POSSIBLE.handle(argValue);
}
- /**
- *
- */
abstract Expression implementSafe(RexToLixTranslator translator,
RexCall call, List<Expression> argValueList);
}
@@ -2291,9 +2088,6 @@ public class RexImpTable {
* else if any arguments are null, result is null; else true.
*/
private static class LogicalAndImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
LogicalAndImplementor() {
super(NullPolicy.NONE, true);
}
@@ -2357,9 +2151,6 @@ public class RexImpTable {
* else if any arguments are null, result is null; else false.
*/
private static class LogicalOrImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
LogicalOrImplementor() {
super(NullPolicy.NONE, true);
}
@@ -2422,9 +2213,6 @@ public class RexImpTable {
* else if any arguments are null, result is null; else false.
*/
private static class LogicalNotImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
LogicalNotImplementor() {
super(NullPolicy.NONE, true);
}
@@ -2450,14 +2238,8 @@ public class RexImpTable {
* created.
*/
private static class ReflectiveImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
protected final Method method;
- /**
- *
- */
ReflectiveImplementor(Method method, NullPolicy nullPolicy) {
super(nullPolicy, false);
this.method = method;
@@ -2487,17 +2269,11 @@ public class RexImpTable {
/** Implementor for the {@code RAND} function. */
private static class RandImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
private final AbstractRexCallImplementor[] implementors = {
new ReflectiveImplementor(BuiltInMethod.RAND.method, nullPolicy),
new ReflectiveImplementor(BuiltInMethod.RAND_SEED.method, nullPolicy)
};
- /**
- *
- */
RandImplementor() {
super(NullPolicy.STRICT, false);
}
@@ -2519,18 +2295,12 @@ public class RexImpTable {
/** Implementor for the {@code RAND_INTEGER} function. */
private static class RandIntegerImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
private final AbstractRexCallImplementor[] implementors = {
null,
new ReflectiveImplementor(BuiltInMethod.RAND_INTEGER.method, nullPolicy),
new ReflectiveImplementor(BuiltInMethod.RAND_INTEGER_SEED.method, nullPolicy)
};
- /**
- *
- */
RandIntegerImplementor() {
super(NullPolicy.STRICT, false);
}
@@ -2552,9 +2322,6 @@ public class RexImpTable {
/** Implementor for the {@code PI} operator. */
private static class PiImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
PiImplementor() {
super(NullPolicy.NONE, false);
}
@@ -2575,9 +2342,6 @@ public class RexImpTable {
/** Implementor for the {@code IS FALSE} SQL operator. */
private static class IsFalseImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
IsFalseImplementor() {
super(NullPolicy.STRICT, false);
}
@@ -2604,9 +2368,6 @@ public class RexImpTable {
/** Implementor for the {@code IS NOT FALSE} SQL operator. */
private static class IsNotFalseImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
IsNotFalseImplementor() {
super(NullPolicy.STRICT, false);
}
@@ -2633,9 +2394,6 @@ public class RexImpTable {
/** Implementor for the {@code IS NOT NULL} SQL operator. */
private static class IsNotNullImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
IsNotNullImplementor() {
super(NullPolicy.STRICT, false);
}
@@ -2662,9 +2420,6 @@ public class RexImpTable {
/** Implementor for the {@code IS NOT TRUE} SQL operator. */
private static class IsNotTrueImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
IsNotTrueImplementor() {
super(NullPolicy.STRICT, false);
}
@@ -2691,9 +2446,6 @@ public class RexImpTable {
/** Implementor for the {@code IS NULL} SQL operator. */
private static class IsNullImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
IsNullImplementor() {
super(NullPolicy.STRICT, false);
}
@@ -2720,9 +2472,6 @@ public class RexImpTable {
/** Implementor for the {@code IS TRUE} SQL operator. */
private static class IsTrueImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
IsTrueImplementor() {
super(NullPolicy.STRICT, false);
}
@@ -2756,9 +2505,6 @@ public class RexImpTable {
new ReflectiveImplementor(BuiltInMethod.REGEXP_REPLACE6.method, nullPolicy),
};
- /**
- *
- */
RegexpReplaceImplementor() {
super(NullPolicy.STRICT, false);
}
@@ -2779,9 +2525,6 @@ public class RexImpTable {
/** Implementor for the {@code DEFAULT} function. */
private static class DefaultImplementor extends AbstractRexCallImplementor {
- /**
- *
- */
DefaultImplementor() {
super(NullPolicy.NONE, false);
}
@@ -2801,7 +2544,8 @@ public class RexImpTable {
}
/**
- *
+ * CreateTableFunctionImplementor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
private static CallImplementor createTableFunctionImplementor(final Method method) {
return createImplementor(
@@ -2833,7 +2577,8 @@ public class RexImpTable {
}
/**
- *
+ * CreateImplementor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public static CallImplementor createImplementor(
final NotNullImplementor implementor,
@@ -2849,9 +2594,6 @@ public class RexImpTable {
};
}
- /**
- *
- */
private static RexCallImplementor createRexCallImplementor(
final NotNullImplementor implementor,
final NullPolicy nullPolicy,
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/RexToLixTranslator.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/RexToLixTranslator.java
index 363f484..432095d 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/RexToLixTranslator.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/RexToLixTranslator.java
@@ -76,49 +76,25 @@ import org.apache.calcite.util.Pair;
* Translates {@link RexNode REX expressions} to {@link Expression linq4j expressions}.
*/
public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result> {
- /**
- *
- */
final JavaTypeFactory typeFactory;
- /**
- *
- */
final RexBuilder builder;
- /**
- *
- */
private final RexProgram program;
- /**
- *
- */
final SqlConformance conformance;
- /**
- *
- */
private final Expression root;
- /**
- *
- */
final RexToLixTranslator.InputGetter inputGetter;
- /**
- *
- */
private final BlockBuilder list;
- /**
- *
- */
private final Function1<String, InputGetter> correlates;
/**
- * Map from RexLiteral's variable name to its literal, which is often a ({@link ConstantExpression})) It is used in the some {@code
- * RexCall}'s implementors, such as {@code ExtractImplementor}.
+ * Map from RexLiteral's variable name to its literal, which is often a ({@link ConstantExpression})).
+ * It is used in the some {@code RexCall}'s implementors, such as {@code ExtractImplementor}.
*
* @see #getLiteral
* @see #getLiteralValue
@@ -126,13 +102,14 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
private final Map<Expression, Expression> literalMap = new HashMap<>();
/**
- * For {@code RexCall}, keep the list of its operand's {@code Result}. It is useful when creating a {@code CallImplementor}.
+ * For {@code RexCall}, keep the list of its operand's {@code Result}. It is useful when creating a
+ * {@code CallImplementor}.
*/
private final Map<RexCall, List<Result>> callOperandResultMap = new HashMap<>();
/**
- * Map from RexNode under specific storage type to its Result, to avoid generating duplicate code. For {@code RexInputRef}, {@code
- * RexDynamicParam} and {@code RexFieldAccess}.
+ * Map from RexNode under specific storage type to its Result, to avoid generating duplicate code. For
+ * {@code RexInputRef}, {@code RexDynamicParam} and {@code RexFieldAccess}.
*/
private final Map<Pair<RexNode, Type>, Result> rexWithStorageTypeResultMap = new HashMap<>();
@@ -141,13 +118,11 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
*/
private final Map<RexNode, Result> rexResultMap = new HashMap<>();
- /**
- *
- */
private Type currentStorageType;
/**
- *
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
private RexToLixTranslator(RexProgram program,
JavaTypeFactory typeFactory,
@@ -198,34 +173,22 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
.translateList(program.getProjectList(), storageTypes);
}
- /**
- *
- */
Expression translate(RexNode expr) {
final RexImpTable.NullAs nullAs =
RexImpTable.NullAs.of(isNullable(expr));
return translate(expr, nullAs);
}
- /**
- *
- */
Expression translate(RexNode expr, RexImpTable.NullAs nullAs) {
return translate(expr, nullAs, null);
}
- /**
- *
- */
Expression translate(RexNode expr, Type storageType) {
final RexImpTable.NullAs nullAs =
RexImpTable.NullAs.of(isNullable(expr));
return translate(expr, nullAs, storageType);
}
- /**
- *
- */
Expression translate(RexNode expr, RexImpTable.NullAs nullAs,
Type storageType) {
currentStorageType = storageType;
@@ -242,9 +205,6 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
return nullAs.handle(translated);
}
- /**
- *
- */
Expression translateCast(
RelDataType sourceType,
RelDataType targetType,
@@ -761,9 +721,6 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
return Expressions.constant(value2, javaClass);
}
- /**
- *
- */
public List<Expression> translateList(
List<RexNode> operandList,
RexImpTable.NullAs nullAs) {
@@ -772,7 +729,8 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
}
/**
- *
+ * TranslateList.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public List<Expression> translateList(
List<RexNode> operandList,
@@ -787,24 +745,26 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
}
/**
- * Translates the list of {@code RexNode}, using the default output types. This might be suboptimal in terms of additional box-unbox
- * when you use the translation later. If you know the java class that will be used to store the results, use {@link
- * RexToLixTranslator#translateList(List, List)} version.
+ * Translates the list of {@code RexNode}, using the default output types. This might be suboptimal in terms of
+ * additional box-unbox when you use the translation later. If you know the java class that will be used to store
+ * the results, use {@link RexToLixTranslator#translateList(List, List)} version.
*
- * @param operandList list of RexNodes to translate
- * @return translated expressions
+ * @param operandList List of RexNodes to translate.
+ * @return Translated expressions.
*/
public List<Expression> translateList(List<? extends RexNode> operandList) {
return translateList(operandList, ConverterUtils.internalTypes(operandList));
}
/**
- * Translates the list of {@code RexNode}, while optimizing for output storage. For instance, if the result of translation is going to
- * be stored in {@code Object[]}, and the input is {@code Object[]} as well, then translator will avoid casting, boxing, etc.
+ * Translates the list of {@code RexNode}, while optimizing for output storage. For instance, if the result of
+ * translation is going to be stored in {@code Object[]}, and the input is {@code Object[]} as well, then translator
+ * will avoid casting, boxing, etc.
*
- * @param operandList list of RexNodes to translate
- * @param storageTypes hints of the java classes that will be used to store translation results. Use null to use default storage type
- * @return translated expressions
+ * @param operandList list of RexNodes to translate.
+ * @param storageTypes hints of the java classes that will be used to store translation results. Use null to use
+ * default storage type.
+ * @return translated expressions.
*/
public List<Expression> translateList(List<? extends RexNode> operandList,
List<? extends Type> storageTypes) {
@@ -834,15 +794,16 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
/**
* Returns whether an expression is nullable.
*
- * @param e Expression
- * @return Whether expression is nullable
+ * @param e Expression.
+ * @return Whether expression is nullable.
*/
public boolean isNullable(RexNode e) {
return e.getType().isNullable();
}
/**
- *
+ * Set block.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public RexToLixTranslator setBlock(BlockBuilder block) {
if (block == list) {
@@ -854,7 +815,8 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
}
/**
- *
+ * Set correlates.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public RexToLixTranslator setCorrelates(
Function1<String, InputGetter> correlates) {
@@ -866,16 +828,10 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
builder, conformance, correlates);
}
- /**
- *
- */
public Expression getRoot() {
return root;
}
- /**
- *
- */
private static Expression scaleIntervalToNumber(
RelDataType sourceType,
RelDataType targetType,
@@ -912,10 +868,11 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
}
/**
- * Visit {@code RexInputRef}. If it has never been visited under current storage type before, {@code RexToLixTranslator} generally
- * produces three lines of code. For example, when visiting a column (named commission) in table Employee, the generated code snippet
- * is: {@code final Employee current =(Employee) inputEnumerator.current(); final Integer input_value = current.commission; final
- * boolean input_isNull = input_value == null; }
+ * Visit {@code RexInputRef}. If it has never been visited under current storage type before,
+ * {@code RexToLixTranslator} generally produces three lines of code. For example, when visiting a column (named
+ * commission) in table Employee, the generated code snippet is: {@code final Employee current =(Employee)
+ * inputEnumerator.current(); final Integer input_value = current.commission; final boolean
+ * input_isNull = input_value == null; }.
*/
@Override
public Result visitInputRef(RexInputRef inputRef) {
@@ -961,9 +918,9 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
}
/**
- * Visit {@code RexLiteral}. If it has never been visited before, {@code RexToLixTranslator} will generate two lines of code. For
- * example, when visiting a primitive int (10), the generated code snippet is: {@code final int literal_value = 10; final boolean
- * literal_isNull = false; }
+ * Visit {@code RexLiteral}. If it has never been visited before, {@code RexToLixTranslator} will generate two lines
+ * of code. For example, when visiting a primitive int (10), the generated code snippet is:
+ * {@code final int literal_value = 10; final boolean literal_isNull = false; }
*/
@Override
public Result visitLiteral(RexLiteral literal) {
@@ -1038,8 +995,8 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
}
/**
- * Visit {@code RexCall}. For most {@code SqlOperator}s, we can get the implementor from {@code RexImpTable}. Several operators (e.g.,
- * CaseWhen) with special semantics need to be implemented separately.
+ * Visit {@code RexCall}. For most {@code SqlOperator}s, we can get the implementor from {@code RexImpTable}.
+ * Several operators (e.g., CaseWhen) with special semantics need to be implemented separately.
*/
@Override
public Result visitCall(RexCall call) {
@@ -1076,9 +1033,6 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
return result;
}
- /**
- *
- */
private static Result implementCallOperand(final RexNode operand,
final Type storageType, final RexToLixTranslator translator) {
final Type originalStorageType = translator.currentStorageType;
@@ -1091,9 +1045,6 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
return operandResult;
}
- /**
- *
- */
private static Expression implementCallOperand2(final RexNode operand,
final Type storageType, final RexToLixTranslator translator) {
final Type originalStorageType = translator.currentStorageType;
@@ -1104,8 +1055,9 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
}
/**
- * The CASE operator is SQL’s way of handling if/then logic. Different with other {@code RexCall}s, it is not safe to implement its
- * operands first. For example: {@code select case when s=0 then false else 100/s > 0 end from (values (1),(0)) ax(s); }
+ * The CASE operator is SQL’s way of handling if/then logic. Different with other {@code RexCall}s, it is not safe
+ * to implement its operands first. For example: {@code select case when s=0 then false else 100/s > 0 end from
+ * (values (1),(0)) ax(s); }.
*/
private Result implementCaseWhen(RexCall call) {
final Type returnType = typeFactory.getJavaClass(call.getType());
@@ -1126,7 +1078,8 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
}
/**
- * Case statements of the form: {@code CASE WHEN a THEN b [WHEN c THEN d]* [ELSE e] END}. When {@code a = true}, returns {@code b}; when
+ * Case statements of the form: {@code CASE WHEN a THEN b [WHEN c THEN d]* [ELSE e] END}. When {@code a = true},
+ * returns {@code b}; when
* {@code c = true}, returns {@code d}; else returns {@code e}.
*
* <p>We generate code that looks like:
@@ -1201,9 +1154,6 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
Expressions.ifThenElse(tester, ifTrue, ifFalse));
}
- /**
- *
- */
private Result toInnerStorageType(final Result result, final Type storageType) {
final Expression valueExpression =
ConverterUtils.toInternal(result.valueVariable, storageType);
@@ -1331,9 +1281,6 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
return visitInputRef(fieldRef);
}
- /**
- *
- */
Expression checkNull(Expression expr) {
if (Primitive.flavor(expr.getType()) == Primitive.Flavor.PRIMITIVE) {
return RexImpTable.FALSE_EXPR;
@@ -1342,9 +1289,6 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
return Expressions.equal(expr, RexImpTable.NULL_EXPR);
}
- /**
- *
- */
Expression checkNotNull(Expression expr) {
if (Primitive.flavor(expr.getType()) == Primitive.Flavor.PRIMITIVE) {
return RexImpTable.TRUE_EXPR;
@@ -1353,16 +1297,10 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
return Expressions.notEqual(expr, RexImpTable.NULL_EXPR);
}
- /**
- *
- */
BlockBuilder getBlockBuilder() {
return list;
}
- /**
- *
- */
Expression getLiteral(Expression literalVariable) {
return literalMap.get(literalVariable);
}
@@ -1380,36 +1318,21 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
return null;
}
- /**
- *
- */
List<Result> getCallOperandResult(RexCall call) {
return callOperandResultMap.get(call);
}
/** Translates a field of an input to an expression. */
public interface InputGetter {
- /**
- *
- */
Expression field(BlockBuilder list, int index, Type storageType);
}
/** Result of translating a {@code RexNode}. */
public static class Result {
- /**
- *
- */
final ParameterExpression isNullVariable;
- /**
- *
- */
final ParameterExpression valueVariable;
- /**
- *
- */
public Result(ParameterExpression isNullVariable,
ParameterExpression valueVariable) {
this.isNullVariable = isNullVariable;
@@ -1418,8 +1341,8 @@ public class RexToLixTranslator implements RexVisitor<RexToLixTranslator.Result>
}
/**
- * Handle checked Exceptions declared in Method. In such case, method call should be wrapped in a try...catch block. " final Type
- * method_call; try { method_call = callExpr } catch (Exception e) { throw new RuntimeException(e); } "
+ * Handle checked Exceptions declared in Method. In such case, method call should be wrapped in a try...catch block.
+ * " final Type method_call; try { method_call = callExpr } catch (Exception e) { throw new RuntimeException(e); } "
*/
Expression handleMethodCheckedExceptions(Expression callExpr) {
// Try statement
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/Scalar.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/Scalar.java
index 0a53bf4..dfcc2c1 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/Scalar.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/Scalar.java
@@ -20,11 +20,9 @@ package org.apache.ignite.internal.processors.query.calcite.exec.exp;
import org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext;
/**
- *
+ * Scalar.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public interface Scalar {
- /**
- *
- */
void execute(ExecutionContext ctx, Object in, Object out);
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/Accumulator.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/Accumulator.java
index fc6fd09..4791144 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/Accumulator.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/Accumulator.java
@@ -23,31 +23,16 @@ import org.apache.calcite.rel.type.RelDataType;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
/**
- *
+ * Accumulator interface.
*/
public interface Accumulator extends Serializable {
- /**
- *
- */
void add(Object... args);
- /**
- *
- */
void apply(Accumulator other);
- /**
- *
- */
Object end();
- /**
- *
- */
List<RelDataType> argumentTypes(IgniteTypeFactory typeFactory);
- /**
- *
- */
RelDataType returnType(IgniteTypeFactory typeFactory);
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/AccumulatorWrapper.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/AccumulatorWrapper.java
index 296a74e..65c9480 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/AccumulatorWrapper.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/AccumulatorWrapper.java
@@ -18,26 +18,15 @@
package org.apache.ignite.internal.processors.query.calcite.exec.exp.agg;
/**
- *
+ * AccumulatorWrapper interface.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public interface AccumulatorWrapper<RowT> {
- /**
- *
- */
void add(RowT row);
- /**
- *
- */
Object end();
- /**
- *
- */
void apply(Accumulator accumulator);
- /**
- *
- */
Accumulator accumulator();
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/Accumulators.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/Accumulators.java
index 1ccf8a6..edb66ba 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/Accumulators.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/Accumulators.java
@@ -37,11 +37,13 @@ import org.apache.calcite.rel.type.RelDataType;
import org.apache.ignite.internal.processors.query.calcite.type.IgniteTypeFactory;
/**
- *
+ * Accumulators.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class Accumulators {
/**
- *
+ * AccumulatorFactory.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public static Supplier<Accumulator> accumulatorFactory(AggregateCall call) {
if (!call.isDistinct()) {
@@ -54,7 +56,8 @@ public class Accumulators {
}
/**
- *
+ * AccumulatorFunctionFactory.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public static Supplier<Accumulator> accumulatorFunctionFactory(AggregateCall call) {
switch (call.getAggregation().getName()) {
@@ -77,9 +80,6 @@ public class Accumulators {
}
}
- /**
- *
- */
private static Supplier<Accumulator> avgFactory(AggregateCall call) {
switch (call.type.getSqlTypeName()) {
case BIGINT:
@@ -94,9 +94,6 @@ public class Accumulators {
}
}
- /**
- *
- */
private static Supplier<Accumulator> sumFactory(AggregateCall call) {
switch (call.type.getSqlTypeName()) {
case DOUBLE:
@@ -113,9 +110,6 @@ public class Accumulators {
}
}
- /**
- *
- */
private static Supplier<Accumulator> sumEmptyIsZeroFactory(AggregateCall call) {
switch (call.type.getSqlTypeName()) {
case DOUBLE:
@@ -132,9 +126,6 @@ public class Accumulators {
}
}
- /**
- *
- */
private static Supplier<Accumulator> minFactory(AggregateCall call) {
switch (call.type.getSqlTypeName()) {
case DOUBLE:
@@ -154,9 +145,6 @@ public class Accumulators {
}
}
- /**
- *
- */
private static Supplier<Accumulator> maxFactory(AggregateCall call) {
switch (call.type.getSqlTypeName()) {
case DOUBLE:
@@ -177,22 +165,14 @@ public class Accumulators {
}
/**
- *
+ * SingleVal.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
private static class SingleVal implements Accumulator {
- /**
- *
- */
private Object holder;
- /**
- *
- */
private boolean touched;
- /**
- *
- */
public static final Supplier<Accumulator> FACTORY = SingleVal::new;
/** {@inheritDoc} */
@@ -240,22 +220,14 @@ public class Accumulators {
}
/**
- *
+ * DecimalAvg.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public static class DecimalAvg implements Accumulator {
- /**
- *
- */
public static final Supplier<Accumulator> FACTORY = DecimalAvg::new;
- /**
- *
- */
private BigDecimal sum = BigDecimal.ZERO;
- /**
- *
- */
private BigDecimal cnt = BigDecimal.ZERO;
/** {@inheritDoc} */
@@ -300,22 +272,14 @@ public class Accumulators {
}
/**
- *
+ * DoubleAvg.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public static class DoubleAvg implements Accumulator {
- /**
- *
- */
public static final Supplier<Accumulator> FACTORY = DoubleAvg::new;
- /**
- *
- */
private double sum;
- /**
- *
- */
private long cnt;
/** {@inheritDoc} */
@@ -359,18 +323,9 @@ public class Accumulators {
}
}
- /**
- *
- */
private static class LongCount implements Accumulator {
- /**
- *
- */
public static final Supplier<Accumulator> FACTORY = LongCount::new;
- /**
- *
- */
private long cnt;
/** {@inheritDoc} */
@@ -409,23 +364,11 @@ public class Accumulators {
}
}
- /**
- *
- */
private static class DoubleSum implements Accumulator {
- /**
- *
- */
public static final Supplier<Accumulator> FACTORY = DoubleSum::new;
- /**
- *
- */
private double sum;
- /**
- *
- */
private boolean empty = true;
/** {@inheritDoc} */
@@ -473,23 +416,11 @@ public class Accumulators {
}
}
- /**
- *
- */
private static class IntSum implements Accumulator {
- /**
- *
- */
public static final Supplier<Accumulator> FACTORY = IntSum::new;
- /**
- *
- */
private int sum;
- /**
- *
- */
private boolean empty = true;
/** {@inheritDoc} */
@@ -537,23 +468,11 @@ public class Accumulators {
}
}
- /**
- *
- */
private static class LongSum implements Accumulator {
- /**
- *
- */
public static final Supplier<Accumulator> FACTORY = LongSum::new;
- /**
- *
- */
private long sum;
- /**
- *
- */
private boolean empty = true;
/** {@inheritDoc} */
@@ -601,18 +520,9 @@ public class Accumulators {
}
}
- /**
- *
- */
private static class DecimalSum implements Accumulator {
- /**
- *
- */
public static final Supplier<Accumulator> FACTORY = DecimalSum::new;
- /**
- *
- */
private BigDecimal sum;
/** {@inheritDoc} */
@@ -658,18 +568,9 @@ public class Accumulators {
}
}
- /**
- *
- */
private static class DoubleSumEmptyIsZero implements Accumulator {
- /**
- *
- */
public static final Supplier<Accumulator> FACTORY = DoubleSumEmptyIsZero::new;
- /**
- *
- */
private double sum;
/** {@inheritDoc} */
@@ -711,18 +612,9 @@ public class Accumulators {
}
}
- /**
- *
- */
private static class IntSumEmptyIsZero implements Accumulator {
- /**
- *
- */
public static final Supplier<Accumulator> FACTORY = IntSumEmptyIsZero::new;
- /**
- *
- */
private int sum;
/** {@inheritDoc} */
@@ -764,18 +656,9 @@ public class Accumulators {
}
}
- /**
- *
- */
private static class LongSumEmptyIsZero implements Accumulator {
- /**
- *
- */
public static final Supplier<Accumulator> FACTORY = LongSumEmptyIsZero::new;
- /**
- *
- */
private long sum;
/** {@inheritDoc} */
@@ -817,18 +700,9 @@ public class Accumulators {
}
}
- /**
- *
- */
private static class DecimalSumEmptyIsZero implements Accumulator {
- /**
- *
- */
public static final Supplier<Accumulator> FACTORY = DecimalSumEmptyIsZero::new;
- /**
- *
- */
private BigDecimal sum;
/** {@inheritDoc} */
@@ -870,38 +744,17 @@ public class Accumulators {
}
}
- /**
- *
- */
private static class DoubleMinMax implements Accumulator {
- /**
- *
- */
public static final Supplier<Accumulator> MIN_FACTORY = () -> new DoubleMinMax(true);
- /**
- *
- */
public static final Supplier<Accumulator> MAX_FACTORY = () -> new DoubleMinMax(false);
- /**
- *
- */
private final boolean min;
- /**
- *
- */
private double val;
- /**
- *
- */
private boolean empty = true;
- /**
- *
- */
private DoubleMinMax(boolean min) {
this.min = min;
}
@@ -951,38 +804,17 @@ public class Accumulators {
}
}
- /**
- *
- */
private static class VarCharMinMax implements Accumulator {
- /**
- *
- */
public static final Supplier<Accumulator> MIN_FACTORY = () -> new VarCharMinMax(true);
- /**
- *
- */
public static final Supplier<Accumulator> MAX_FACTORY = () -> new VarCharMinMax(false);
- /**
- *
- */
private final boolean min;
- /**
- *
- */
private CharSequence val;
- /**
- *
- */
private boolean empty = true;
- /**
- *
- */
private VarCharMinMax(boolean min) {
this.min = min;
}
@@ -1037,19 +869,10 @@ public class Accumulators {
return typeFactory.createTypeWithNullability(typeFactory.createSqlType(VARCHAR), true);
}
- /**
- *
- */
@SuppressWarnings("ComparatorNotSerializable")
private static class CharSeqComparator implements Comparator<CharSequence> {
- /**
- *
- */
private static final CharSeqComparator INSTANCE = new CharSeqComparator();
- /**
- *
- */
@Override
public int compare(CharSequence s1, CharSequence s2) {
int len = Math.min(s1.length(), s2.length());
@@ -1068,38 +891,17 @@ public class Accumulators {
}
}
- /**
- *
- */
private static class IntMinMax implements Accumulator {
- /**
- *
- */
public static final Supplier<Accumulator> MIN_FACTORY = () -> new IntMinMax(true);
- /**
- *
- */
public static final Supplier<Accumulator> MAX_FACTORY = () -> new IntMinMax(false);
- /**
- *
- */
private final boolean min;
- /**
- *
- */
private int val;
- /**
- *
- */
private boolean empty = true;
- /**
- *
- */
private IntMinMax(boolean min) {
this.min = min;
}
@@ -1149,38 +951,17 @@ public class Accumulators {
}
}
- /**
- *
- */
private static class LongMinMax implements Accumulator {
- /**
- *
- */
public static final Supplier<Accumulator> MIN_FACTORY = () -> new LongMinMax(true);
- /**
- *
- */
public static final Supplier<Accumulator> MAX_FACTORY = () -> new LongMinMax(false);
- /**
- *
- */
private final boolean min;
- /**
- *
- */
private long val;
- /**
- *
- */
private boolean empty = true;
- /**
- *
- */
private LongMinMax(boolean min) {
this.min = min;
}
@@ -1230,33 +1011,15 @@ public class Accumulators {
}
}
- /**
- *
- */
private static class DecimalMinMax implements Accumulator {
- /**
- *
- */
public static final Supplier<Accumulator> MIN_FACTORY = () -> new DecimalMinMax(true);
- /**
- *
- */
public static final Supplier<Accumulator> MAX_FACTORY = () -> new DecimalMinMax(false);
- /**
- *
- */
private final boolean min;
- /**
- *
- */
private BigDecimal val;
- /**
- *
- */
private DecimalMinMax(boolean min) {
this.min = min;
}
@@ -1304,23 +1067,11 @@ public class Accumulators {
}
}
- /**
- *
- */
private static class DistinctAccumulator implements Accumulator {
- /**
- *
- */
private final Accumulator acc;
- /**
- *
- */
private final Set<Object> set = new HashSet<>();
- /**
- *
- */
private DistinctAccumulator(Supplier<Accumulator> accSup) {
this.acc = accSup.get();
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/AccumulatorsFactory.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/AccumulatorsFactory.java
index 8224b34..59a5b4a 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/AccumulatorsFactory.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/AccumulatorsFactory.java
@@ -54,26 +54,22 @@ import org.apache.ignite.internal.processors.query.calcite.util.Primitives;
import org.jetbrains.annotations.NotNull;
/**
- *
+ * AccumulatorsFactory.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class AccumulatorsFactory<RowT> implements Supplier<List<AccumulatorWrapper<RowT>>> {
- /**
- *
- */
private static final LoadingCache<Pair<RelDataType, RelDataType>, Function<Object, Object>> CACHE =
Caffeine.newBuilder().build(AccumulatorsFactory::cast0);
/**
- *
+ * CastFunction interface.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public interface CastFunction extends Function<Object, Object> {
@Override
Object apply(Object o);
}
- /**
- *
- */
private static Function<Object, Object> cast(RelDataType from, RelDataType to) {
assert !from.isStruct();
assert !to.isStruct();
@@ -81,16 +77,10 @@ public class AccumulatorsFactory<RowT> implements Supplier<List<AccumulatorWrapp
return cast(Pair.of(from, to));
}
- /**
- *
- */
private static Function<Object, Object> cast(Pair<RelDataType, RelDataType> types) {
return CACHE.get(types);
}
- /**
- *
- */
private static Function<Object, Object> cast0(Pair<RelDataType, RelDataType> types) {
IgniteTypeFactory typeFactory = PlanningContext.empty().typeFactory();
@@ -111,9 +101,6 @@ public class AccumulatorsFactory<RowT> implements Supplier<List<AccumulatorWrapp
return compileCast(typeFactory, from, to);
}
- /**
- *
- */
private static Function<Object, Object> compileCast(IgniteTypeFactory typeFactory, RelDataType from,
RelDataType to) {
RelDataType rowType = createRowType(typeFactory, from);
@@ -142,28 +129,17 @@ public class AccumulatorsFactory<RowT> implements Supplier<List<AccumulatorWrapp
return Commons.compile(CastFunction.class, Expressions.toString(List.of(decl), "\n", false));
}
- /**
- *
- */
private final ExecutionContext<RowT> ctx;
- /**
- *
- */
private final AggregateType type;
- /**
- *
- */
private final RelDataType inputRowType;
- /**
- *
- */
private final List<WrapperPrototype> prototypes;
/**
- *
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public AccumulatorsFactory(
ExecutionContext<RowT> ctx,
@@ -184,33 +160,15 @@ public class AccumulatorsFactory<RowT> implements Supplier<List<AccumulatorWrapp
return Commons.transform(prototypes, WrapperPrototype::get);
}
- /**
- *
- */
private final class WrapperPrototype implements Supplier<AccumulatorWrapper<RowT>> {
- /**
- *
- */
private Supplier<Accumulator> accFactory;
- /**
- *
- */
private final AggregateCall call;
- /**
- *
- */
private Function<Object[], Object[]> inAdapter;
- /**
- *
- */
private Function<Object, Object> outAdapter;
- /**
- *
- */
private WrapperPrototype(AggregateCall call) {
this.call = call;
}
@@ -223,9 +181,6 @@ public class AccumulatorsFactory<RowT> implements Supplier<List<AccumulatorWrapp
return new AccumulatorWrapperImpl(accumulator, call, inAdapter, outAdapter);
}
- /**
- *
- */
@NotNull
private Accumulator accumulator() {
if (accFactory != null) {
@@ -242,9 +197,6 @@ public class AccumulatorsFactory<RowT> implements Supplier<List<AccumulatorWrapp
return accumulator;
}
- /**
- *
- */
@NotNull
private Function<Object[], Object[]> createInAdapter(Accumulator accumulator) {
if (type == AggregateType.REDUCE || nullOrEmpty(call.getArgList())) {
@@ -272,9 +224,6 @@ public class AccumulatorsFactory<RowT> implements Supplier<List<AccumulatorWrapp
};
}
- /**
- *
- */
@NotNull
private Function<Object, Object> createOutAdapter(Accumulator accumulator) {
if (type == AggregateType.MAP) {
@@ -287,56 +236,26 @@ public class AccumulatorsFactory<RowT> implements Supplier<List<AccumulatorWrapp
return cast(inType, outType);
}
- /**
- *
- */
private RelDataType nonNull(RelDataType type) {
return ctx.getTypeFactory().createTypeWithNullability(type, false);
}
}
- /**
- *
- */
private final class AccumulatorWrapperImpl implements AccumulatorWrapper<RowT> {
- /**
- *
- */
private final Accumulator accumulator;
- /**
- *
- */
private final Function<Object[], Object[]> inAdapter;
- /**
- *
- */
private final Function<Object, Object> outAdapter;
- /**
- *
- */
private final List<Integer> argList;
- /**
- *
- */
private final int filterArg;
- /**
- *
- */
private final boolean ignoreNulls;
- /**
- *
- */
private final RowHandler<RowT> handler;
- /**
- *
- */
AccumulatorWrapperImpl(
Accumulator accumulator,
AggregateCall call,
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/AggregateType.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/AggregateType.java
index c743e2a..7a25cff 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/AggregateType.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/AggregateType.java
@@ -18,7 +18,8 @@
package org.apache.ignite.internal.processors.query.calcite.exec.exp.agg;
/**
- *
+ * AggregateType.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public enum AggregateType {
/** Map phase. */
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/GroupKey.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/GroupKey.java
index 6110b01..e09409c 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/GroupKey.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/exp/agg/GroupKey.java
@@ -23,36 +23,22 @@ import java.io.Serializable;
import java.util.Arrays;
/**
- *
+ * GroupKey.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class GroupKey implements Serializable {
- /**
- *
- */
public static final GroupKey EMPTY_GRP_KEY = new GroupKey(OBJECT_EMPTY_ARRAY);
- /**
- *
- */
private final Object[] fields;
- /**
- *
- */
public GroupKey(Object[] fields) {
this.fields = fields;
}
- /**
- *
- */
public Object field(int idx) {
return fields[idx];
}
- /**
- *
- */
public int fieldsCount() {
return fields.length;
}
@@ -84,36 +70,26 @@ public class GroupKey implements Serializable {
return "GroupKey" + Arrays.toString(fields);
}
- /**
- *
- */
public static Builder builder(int rowLen) {
return new Builder(rowLen);
}
/**
- *
+ * Builder.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public static class Builder {
- /**
- *
- */
private final Object[] fields;
- /**
- *
- */
private int idx;
- /**
- *
- */
private Builder(int rowLen) {
fields = new Object[rowLen];
}
/**
- *
+ * Add.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public Builder add(Object val) {
if (idx == fields.length) {
@@ -126,7 +102,8 @@ public class GroupKey implements Serializable {
}
/**
- *
+ * Build.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public GroupKey build() {
assert idx == fields.length;
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/AbstractNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/AbstractNode.java
index e20d8fb..106523f 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/AbstractNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/AbstractNode.java
@@ -34,62 +34,42 @@ import org.apache.ignite.lang.IgniteLogger;
* Abstract node of execution tree.
*/
public abstract class AbstractNode<RowT> implements Node<RowT> {
- /**
- *
- */
protected static final int MODIFY_BATCH_SIZE = 100; //IgniteSystemProperties.getInteger("IGNITE_CALCITE_EXEC_BATCH_SIZE", 100);
- /**
- *
- */
protected static final int IO_BATCH_SIZE = 256; //IgniteSystemProperties.getInteger("IGNITE_CALCITE_EXEC_IO_BATCH_SIZE", 256);
- /**
- *
- */
protected static final int IO_BATCH_CNT = 4; //IgniteSystemProperties.getInteger("IGNITE_CALCITE_EXEC_IO_BATCH_CNT", 4);
- /**
- *
- */
protected final int inBufSize = Commons.IN_BUFFER_SIZE; //IgniteSystemProperties.getInteger("IGNITE_CALCITE_EXEC_IN_BUFFER_SIZE", 2);
- /**
- *
- */
protected final IgniteLogger log = IgniteLogger.forClass(getClass());
- /** for debug purpose */
+ /** For debug purpose. */
private volatile Thread thread;
/**
+ * Execution context.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* {@link Inbox} node may not have proper context at creation time in case it creates on first message received from a remote source.
* This case the context sets in scope of {@link Inbox#init(ExecutionContext, RelDataType, Collection, Comparator)} method call.
*/
private ExecutionContext<RowT> ctx;
- /**
- *
- */
private RelDataType rowType;
- /**
- *
- */
private Downstream<RowT> downstream;
- /**
- *
- */
private boolean closed;
- /**
- *
- */
private List<Node<RowT>> sources;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
+ * @param rowType Rel data type.
*/
protected AbstractNode(ExecutionContext<RowT> ctx, RelDataType rowType) {
this.ctx = ctx;
@@ -102,9 +82,6 @@ public abstract class AbstractNode<RowT> implements Node<RowT> {
return ctx;
}
- /**
- *
- */
protected void context(ExecutionContext<RowT> ctx) {
this.ctx = ctx;
}
@@ -115,9 +92,6 @@ public abstract class AbstractNode<RowT> implements Node<RowT> {
return rowType;
}
- /**
- *
- */
protected void rowType(RelDataType rowType) {
this.rowType = rowType;
}
@@ -181,21 +155,12 @@ public abstract class AbstractNode<RowT> implements Node<RowT> {
}
}
- /**
- *
- */
protected void closeInternal() {
closed = true;
}
- /**
- *
- */
protected abstract void rewindInternal();
- /**
- *
- */
protected void onErrorInternal(Throwable e) {
Downstream<RowT> downstream = downstream();
@@ -209,15 +174,12 @@ public abstract class AbstractNode<RowT> implements Node<RowT> {
}
/**
- * @return {@code true} if the subtree is canceled.
+ * Get closed flag: {@code true} if the subtree is canceled.
*/
protected boolean isClosed() {
return closed;
}
- /**
- *
- */
protected void checkState() throws Exception {
if (context().isCancelled()) {
throw new ExecutionCancelledException();
@@ -235,14 +197,8 @@ public abstract class AbstractNode<RowT> implements Node<RowT> {
}
}
- /**
- *
- */
protected abstract Downstream<RowT> requestDownstream(int idx);
- /**
- *
- */
@Override
public Downstream<RowT> downstream() {
return downstream;
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/AbstractSetOpNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/AbstractSetOpNode.java
index ea815f0..8a541a2 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/AbstractSetOpNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/AbstractSetOpNode.java
@@ -36,37 +36,19 @@ import org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.GroupKey
* Abstract execution node for set operators (EXCEPT, INTERSECT).
*/
public abstract class AbstractSetOpNode<RowT> extends AbstractNode<RowT> {
- /**
- *
- */
private final AggregateType type;
- /**
- *
- */
private final Grouping<RowT> grouping;
- /**
- *
- */
private int requested;
- /**
- *
- */
private int waiting;
/** Current source index. */
private int curSrcIdx;
- /**
- *
- */
private boolean inLoop;
- /**
- *
- */
protected AbstractSetOpNode(ExecutionContext<RowT> ctx, RelDataType rowType, AggregateType type, boolean all,
RowFactory<RowT> rowFactory, Grouping<RowT> grouping) {
super(ctx, rowType);
@@ -94,7 +76,8 @@ public abstract class AbstractSetOpNode<RowT> extends AbstractNode<RowT> {
}
/**
- *
+ * Push.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public void push(RowT row, int idx) throws Exception {
assert downstream() != null;
@@ -112,7 +95,8 @@ public abstract class AbstractSetOpNode<RowT> extends AbstractNode<RowT> {
}
/**
- *
+ * End.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public void end(int idx) throws Exception {
assert downstream() != null;
@@ -167,9 +151,6 @@ public abstract class AbstractSetOpNode<RowT> extends AbstractNode<RowT> {
};
}
- /**
- *
- */
private void flush() throws Exception {
if (isClosed()) {
return;
@@ -214,40 +195,23 @@ public abstract class AbstractSetOpNode<RowT> extends AbstractNode<RowT> {
}
/**
- *
+ * Grouping.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
protected abstract static class Grouping<RowT> {
- /**
- *
- */
protected final Map<GroupKey, int[]> groups = new HashMap<>();
- /**
- *
- */
protected final RowHandler<RowT> hnd;
- /**
- *
- */
protected final AggregateType type;
- /**
- *
- */
protected final boolean all;
- /**
- *
- */
protected final RowFactory<RowT> rowFactory;
/** Processed rows count in current set. */
protected int rowsCnt = 0;
- /**
- *
- */
protected Grouping(ExecutionContext<RowT> ctx, RowFactory<RowT> rowFactory, AggregateType type, boolean all) {
hnd = ctx.rowHandler();
this.type = type;
@@ -255,9 +219,6 @@ public abstract class AbstractSetOpNode<RowT> extends AbstractNode<RowT> {
this.rowFactory = rowFactory;
}
- /**
- *
- */
private void add(RowT row, int setIdx) {
if (type == AggregateType.REDUCE) {
assert setIdx == 0 : "Unexpected set index: " + setIdx;
@@ -273,6 +234,9 @@ public abstract class AbstractSetOpNode<RowT> extends AbstractNode<RowT> {
}
/**
+ * Get rows.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param cnt Number of rows.
* @return Actually sent rows number.
*/
@@ -286,9 +250,6 @@ public abstract class AbstractSetOpNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
protected GroupKey key(RowT row) {
int size = hnd.columnCount(row);
@@ -301,26 +262,14 @@ public abstract class AbstractSetOpNode<RowT> extends AbstractNode<RowT> {
return new GroupKey(fields);
}
- /**
- *
- */
protected void endOfSet(int setIdx) {
rowsCnt = 0;
}
- /**
- *
- */
protected abstract void addOnSingle(RowT row, int setIdx);
- /**
- *
- */
protected abstract void addOnMapper(RowT row, int setIdx);
- /**
- *
- */
protected void addOnReducer(RowT row) {
GroupKey grpKey = (GroupKey) hnd.get(0, row);
int[] cntrsMap = (int[]) hnd.get(1, row);
@@ -334,9 +283,6 @@ public abstract class AbstractSetOpNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
protected List<RowT> getOnMapper(int cnt) {
Iterator<Map.Entry<GroupKey, int[]>> it = groups.entrySet().iterator();
@@ -359,9 +305,6 @@ public abstract class AbstractSetOpNode<RowT> extends AbstractNode<RowT> {
return res;
}
- /**
- *
- */
protected List<RowT> getOnSingleOrReducer(int cnt) {
Iterator<Map.Entry<GroupKey, int[]>> it = groups.entrySet().iterator();
@@ -413,19 +356,10 @@ public abstract class AbstractSetOpNode<RowT> extends AbstractNode<RowT> {
*/
protected abstract boolean affectResult(int[] cntrs);
- /**
- *
- */
protected abstract int availableRows(int[] cntrs);
- /**
- *
- */
protected abstract void decrementAvailableRows(int[] cntrs, int amount);
- /**
- *
- */
private boolean isEmpty() {
return groups.isEmpty();
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/CorrelatedNestedLoopJoinNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/CorrelatedNestedLoopJoinNode.java
index 667d3ac..733de9b 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/CorrelatedNestedLoopJoinNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/CorrelatedNestedLoopJoinNode.java
@@ -33,99 +33,55 @@ import org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext
import org.apache.ignite.internal.processors.query.calcite.exec.RowHandler;
/**
- *
+ * CorrelatedNestedLoopJoinNode.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class CorrelatedNestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
- /**
- *
- */
private final Predicate<RowT> cond;
- /**
- *
- */
private final List<CorrelationId> correlationIds;
- /**
- *
- */
private final JoinRelType joinType;
- /**
- *
- */
private final RowHandler<RowT> handler;
- /**
- *
- */
private final int leftInBufferSize;
- /**
- *
- */
private final int rightInBufferSize;
- /**
- *
- */
private final BitSet leftMatched = new BitSet();
- /**
- *
- */
private int requested;
- /**
- *
- */
private int waitingLeft;
- /**
- *
- */
private int waitingRight;
- /**
- *
- */
private List<RowT> leftInBuf;
- /**
- *
- */
private List<RowT> rightInBuf;
- /**
- *
- */
private int leftIdx;
- /**
- *
- */
private int rightIdx;
- /**
- *
- */
private RowT rightEmptyRow;
- /**
- *
- */
private State state = State.INITIAL;
- /**
- *
- */
private enum State {
INITIAL, FILLING_LEFT, FILLING_RIGHT, IDLE, IN_LOOP, END
}
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
+ * @param rowType Rel data type.
* @param cond Join expression.
+ * @param correlationIds Set of collections ids.
+ * @param joinType Join rel type.
*/
public CorrelatedNestedLoopJoinNode(ExecutionContext<RowT> ctx, RelDataType rowType, Predicate<RowT> cond,
Set<CorrelationId> correlationIds, JoinRelType joinType) {
@@ -220,9 +176,6 @@ public class CorrelatedNestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
throw new IndexOutOfBoundsException();
}
- /**
- *
- */
private void pushLeft(RowT row) throws Exception {
assert downstream() != null;
assert waitingLeft > 0;
@@ -240,9 +193,6 @@ public class CorrelatedNestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
onPushLeft();
}
- /**
- *
- */
private void pushRight(RowT row) throws Exception {
assert downstream() != null;
assert waitingRight > 0;
@@ -260,9 +210,6 @@ public class CorrelatedNestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
onPushRight();
}
- /**
- *
- */
private void endLeft() throws Exception {
assert downstream() != null;
assert waitingLeft > 0;
@@ -278,9 +225,6 @@ public class CorrelatedNestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
onEndLeft();
}
- /**
- *
- */
private void endRight() throws Exception {
assert downstream() != null;
assert waitingRight > 0;
@@ -296,9 +240,6 @@ public class CorrelatedNestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
onEndRight();
}
- /**
- *
- */
private void onRequest() throws Exception {
switch (state) {
case IN_LOOP:
@@ -342,9 +283,6 @@ public class CorrelatedNestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private void onPushLeft() throws Exception {
assert state == State.FILLING_LEFT : "Unexpected state:" + state;
assert waitingRight == 0 || waitingRight == -1;
@@ -364,9 +302,6 @@ public class CorrelatedNestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private void onPushRight() throws Exception {
assert state == State.FILLING_RIGHT : "Unexpected state:" + state;
assert !nullOrEmpty(leftInBuf);
@@ -381,9 +316,6 @@ public class CorrelatedNestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private void onEndLeft() throws Exception {
assert state == State.FILLING_LEFT : "Unexpected state:" + state;
assert waitingLeft == -1;
@@ -411,9 +343,6 @@ public class CorrelatedNestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private void onEndRight() throws Exception {
assert state == State.FILLING_RIGHT : "Unexpected state:" + state;
assert waitingRight == -1;
@@ -425,9 +354,6 @@ public class CorrelatedNestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
join();
}
- /**
- *
- */
private void join() throws Exception {
assert state == State.IDLE;
@@ -532,23 +458,14 @@ public class CorrelatedNestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private Node<RowT> leftSource() {
return sources().get(0);
}
- /**
- *
- */
private Node<RowT> rightSource() {
return sources().get(1);
}
- /**
- *
- */
private void prepareCorrelations() {
for (int i = 0; i < correlationIds.size(); i++) {
RowT row = i < leftInBuf.size() ? leftInBuf.get(i) : first(leftInBuf);
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/FilterNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/FilterNode.java
index 0487b06..003db6a 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/FilterNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/FilterNode.java
@@ -26,36 +26,26 @@ import org.apache.calcite.rel.type.RelDataType;
import org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext;
/**
- *
+ * FilterNode.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class FilterNode<RowT> extends AbstractNode<RowT> implements SingleNode<RowT>, Downstream<RowT> {
- /**
- *
- */
private final Predicate<RowT> pred;
- /**
- *
- */
private final Deque<RowT> inBuf = new ArrayDeque<>(inBufSize);
- /**
- *
- */
private int requested;
- /**
- *
- */
private int waiting;
- /**
- *
- */
private boolean inLoop;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
+ * @param rowType Rel data type.
* @param pred Predicate.
*/
public FilterNode(ExecutionContext<RowT> ctx, RelDataType rowType, Predicate<RowT> pred) {
@@ -127,18 +117,12 @@ public class FilterNode<RowT> extends AbstractNode<RowT> implements SingleNode<R
inBuf.clear();
}
- /**
- *
- */
private void doFilter() throws Exception {
checkState();
filter();
}
- /**
- *
- */
private void filter() throws Exception {
inLoop = true;
try {
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashAggregateNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashAggregateNode.java
index 9818170..f026036 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashAggregateNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/HashAggregateNode.java
@@ -42,48 +42,30 @@ import org.apache.ignite.internal.processors.query.calcite.util.Commons;
import org.apache.ignite.lang.IgniteInternalException;
/**
- *
+ * HashAggregateNode.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class HashAggregateNode<RowT> extends AbstractNode<RowT> implements SingleNode<RowT>, Downstream<RowT> {
- /**
- *
- */
private final AggregateType type;
/** May be {@code null} when there are not accumulators (DISTINCT aggregate node). */
private final Supplier<List<AccumulatorWrapper<RowT>>> accFactory;
- /**
- *
- */
private final RowFactory<RowT> rowFactory;
- /**
- *
- */
private final ImmutableBitSet grpSet;
- /**
- *
- */
private final List<Grouping> groupings;
- /**
- *
- */
private int requested;
- /**
- *
- */
private int waiting;
- /**
- *
- */
private boolean inLoop;
/**
+ * Constructor.
+ *
* @param ctx Execution context.
*/
public HashAggregateNode(
@@ -181,16 +163,10 @@ public class HashAggregateNode<RowT> extends AbstractNode<RowT> implements Singl
return this;
}
- /**
- *
- */
private boolean hasAccumulators() {
return accFactory != null;
}
- /**
- *
- */
private void flush() throws Exception {
if (isClosed()) {
return;
@@ -240,42 +216,21 @@ public class HashAggregateNode<RowT> extends AbstractNode<RowT> implements Singl
}
}
- /**
- *
- */
private ArrayDeque<Grouping> groupingsQueue() {
return groupings.stream()
.filter(negate(Grouping::isEmpty))
.collect(toCollection(ArrayDeque::new));
}
- /**
- *
- */
private class Grouping {
- /**
- *
- */
private final byte grpId;
- /**
- *
- */
private final ImmutableBitSet grpFields;
- /**
- *
- */
private final Map<GroupKey, List<AccumulatorWrapper<RowT>>> groups = new HashMap<>();
- /**
- *
- */
private final RowHandler<RowT> handler;
- /**
- *
- */
private Grouping(byte grpId, ImmutableBitSet grpFields) {
this.grpId = grpId;
this.grpFields = grpFields;
@@ -289,9 +244,6 @@ public class HashAggregateNode<RowT> extends AbstractNode<RowT> implements Singl
}
}
- /**
- *
- */
private void add(RowT row) {
if (type == AggregateType.REDUCE) {
addOnReducer(row);
@@ -301,6 +253,9 @@ public class HashAggregateNode<RowT> extends AbstractNode<RowT> implements Singl
}
/**
+ * Get rows.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param cnt Number of rows.
* @return Actually sent rows number.
*/
@@ -314,9 +269,6 @@ public class HashAggregateNode<RowT> extends AbstractNode<RowT> implements Singl
}
}
- /**
- *
- */
private void addOnMapper(RowT row) {
GroupKey.Builder b = GroupKey.builder(grpFields.cardinality());
@@ -333,9 +285,6 @@ public class HashAggregateNode<RowT> extends AbstractNode<RowT> implements Singl
}
}
- /**
- *
- */
private void addOnReducer(RowT row) {
byte targetGrpId = (byte) handler.get(0, row);
@@ -356,9 +305,6 @@ public class HashAggregateNode<RowT> extends AbstractNode<RowT> implements Singl
}
}
- /**
- *
- */
private List<RowT> getOnMapper(int cnt) {
Iterator<Map.Entry<GroupKey, List<AccumulatorWrapper<RowT>>>> it = groups.entrySet().iterator();
@@ -381,9 +327,6 @@ public class HashAggregateNode<RowT> extends AbstractNode<RowT> implements Singl
return res;
}
- /**
- *
- */
private List<RowT> getOnReducer(int cnt) {
Iterator<Map.Entry<GroupKey, List<AccumulatorWrapper<RowT>>>> it = groups.entrySet().iterator();
@@ -416,9 +359,6 @@ public class HashAggregateNode<RowT> extends AbstractNode<RowT> implements Singl
return res;
}
- /**
- *
- */
private List<AccumulatorWrapper<RowT>> create(GroupKey key) {
if (accFactory == null) {
return Collections.emptyList();
@@ -427,9 +367,6 @@ public class HashAggregateNode<RowT> extends AbstractNode<RowT> implements Singl
return accFactory.get();
}
- /**
- *
- */
private boolean isEmpty() {
return groups.isEmpty();
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/Inbox.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/Inbox.java
index ee3f6cd..3c24aae 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/Inbox.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/Inbox.java
@@ -39,57 +39,29 @@ import org.jetbrains.annotations.Nullable;
* A part of exchange.
*/
public class Inbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, SingleNode<RowT> {
- /**
- *
- */
private final ExchangeService exchange;
- /**
- *
- */
private final MailboxRegistry registry;
- /**
- *
- */
private final long exchangeId;
- /**
- *
- */
private final long srcFragmentId;
- /**
- *
- */
private final Map<String, Buffer> perNodeBuffers;
- /**
- *
- */
private volatile Collection<String> srcNodeIds;
- /**
- *
- */
private Comparator<RowT> comp;
- /**
- *
- */
private List<Buffer> buffers;
- /**
- *
- */
private int requested;
- /**
- *
- */
private boolean inLoop;
/**
+ * Constructor.
+ *
* @param ctx Execution context.
* @param exchange Exchange service.
* @param registry Mailbox registry.
@@ -121,8 +93,10 @@ public class Inbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, Si
/**
* Inits this Inbox.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*
* @param ctx Execution context.
+ * @param rowType Rel data type.
* @param srcNodeIds Source node IDs.
* @param comp Optional comparator for merge exchange.
*/
@@ -204,18 +178,12 @@ public class Inbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, Si
}
}
- /**
- *
- */
private void doPush() throws Exception {
checkState();
push();
}
- /**
- *
- */
private void push() throws Exception {
if (buffers == null) {
for (String node : srcNodeIds) {
@@ -236,9 +204,6 @@ public class Inbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, Si
}
}
- /**
- *
- */
private void pushOrdered() throws Exception {
PriorityQueue<Pair<RowT, Buffer>> heap =
new PriorityQueue<>(Math.max(buffers.size(), 1), Map.Entry.comparingByKey(comp));
@@ -303,9 +268,6 @@ public class Inbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, Si
}
}
- /**
- *
- */
private void pushUnordered() throws Exception {
int idx = 0;
int noProgress = 0;
@@ -352,29 +314,21 @@ public class Inbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, Si
}
}
- /**
- *
- */
private void acknowledge(String nodeId, int batchId) throws IgniteInternalCheckedException {
exchange.acknowledge(nodeId, queryId(), srcFragmentId, exchangeId, batchId);
}
- /**
- *
- */
private Buffer getOrCreateBuffer(String nodeId) {
return perNodeBuffers.computeIfAbsent(nodeId, this::createBuffer);
}
- /**
- *
- */
private Buffer createBuffer(String nodeId) {
return new Buffer(nodeId);
}
/**
- *
+ * OnNodeLeft.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public void onNodeLeft(String nodeId) {
if (context().originatingNodeId().equals(nodeId) && srcNodeIds == null) {
@@ -384,9 +338,6 @@ public class Inbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, Si
}
}
- /**
- *
- */
private void onNodeLeft0(String nodeId) throws Exception {
checkState();
@@ -395,42 +346,21 @@ public class Inbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, Si
}
}
- /**
- *
- */
private void checkNode(String nodeId) throws IgniteInternalCheckedException {
if (!exchange.alive(nodeId)) {
throw new IgniteInternalCheckedException("Failed to execute query, node left [nodeId=" + nodeId + ']');
}
}
- /**
- *
- */
private static final class Batch<RowT> implements Comparable<Batch<RowT>> {
- /**
- *
- */
private final int batchId;
- /**
- *
- */
private final boolean last;
- /**
- *
- */
private final List<RowT> rows;
- /**
- *
- */
private int idx;
- /**
- *
- */
private Batch(int batchId, boolean last, List<RowT> rows) {
this.batchId = batchId;
this.last = last;
@@ -465,77 +395,35 @@ public class Inbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, Si
}
}
- /**
- *
- */
private enum State {
- /**
- *
- */
END,
- /**
- *
- */
READY,
- /**
- *
- */
WAITING
}
- /**
- *
- */
private static final Batch<?> WAITING = new Batch<>(0, false, null);
- /**
- *
- */
private static final Batch<?> END = new Batch<>(0, false, null);
- /**
- *
- */
private final class Buffer {
- /**
- *
- */
private final String nodeId;
- /**
- *
- */
private int lastEnqueued = -1;
- /**
- *
- */
private final PriorityQueue<Batch<RowT>> batches = new PriorityQueue<>(IO_BATCH_CNT);
- /**
- *
- */
private Batch<RowT> curr = waitingMark();
- /**
- *
- */
private Buffer(String nodeId) {
this.nodeId = nodeId;
}
- /**
- *
- */
private void offer(int id, boolean last, List<RowT> rows) {
batches.offer(new Batch<>(id, last, rows));
}
- /**
- *
- */
private Batch<RowT> pollBatch() {
if (batches.isEmpty() || batches.peek().batchId != lastEnqueued + 1) {
return waitingMark();
@@ -550,9 +438,6 @@ public class Inbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, Si
return batch;
}
- /**
- *
- */
private State check() {
if (finished()) {
return State.END;
@@ -571,9 +456,6 @@ public class Inbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, Si
return State.READY;
}
- /**
- *
- */
private RowT peek() {
assert curr != null;
assert curr != WAITING;
@@ -583,9 +465,6 @@ public class Inbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, Si
return curr.rows.get(curr.idx);
}
- /**
- *
- */
private RowT remove() throws IgniteInternalCheckedException {
assert curr != null;
assert curr != WAITING;
@@ -605,37 +484,22 @@ public class Inbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, Si
return row;
}
- /**
- *
- */
private boolean finished() {
return curr == END;
}
- /**
- *
- */
private boolean waiting() {
return curr == WAITING && (curr = pollBatch()) == WAITING;
}
- /**
- *
- */
private boolean isEnd() {
return curr.last && curr.idx == curr.rows.size();
}
- /**
- *
- */
private Batch<RowT> finishedMark() {
return (Batch<RowT>) END;
}
- /**
- *
- */
private Batch<RowT> waitingMark() {
return (Batch<RowT>) WAITING;
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/IndexSpoolNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/IndexSpoolNode.java
index df7e082..948ff35 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/IndexSpoolNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/IndexSpoolNode.java
@@ -37,21 +37,16 @@ public class IndexSpoolNode<RowT> extends AbstractNode<RowT> implements SingleNo
/** Scan. */
private final ScanNode<RowT> scan;
- /** Runtime index */
+ /** Runtime index. */
private final RuntimeIndex<RowT> idx;
- /**
- *
- */
private int requested;
- /**
- *
- */
private int waiting;
/**
- * @param ctx Execution context.
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
private IndexSpoolNode(
ExecutionContext<RowT> ctx,
@@ -65,17 +60,11 @@ public class IndexSpoolNode<RowT> extends AbstractNode<RowT> implements SingleNo
this.scan = scan;
}
- /**
- *
- */
@Override
public void onRegister(Downstream<RowT> downstream) {
scan.onRegister(downstream);
}
- /**
- *
- */
@Override
public Downstream<RowT> downstream() {
return scan.downstream();
@@ -120,9 +109,6 @@ public class IndexSpoolNode<RowT> extends AbstractNode<RowT> implements SingleNo
}
}
- /**
- *
- */
private void requestSource() throws Exception {
waiting = inBufSize;
@@ -171,15 +157,13 @@ public class IndexSpoolNode<RowT> extends AbstractNode<RowT> implements SingleNo
super.closeInternal();
}
- /**
- *
- */
private boolean indexReady() {
return waiting == -1;
}
/**
- *
+ * CreateTreeSpool.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public static <RowT> IndexSpoolNode<RowT> createTreeSpool(
ExecutionContext<RowT> ctx,
@@ -208,7 +192,8 @@ public class IndexSpoolNode<RowT> extends AbstractNode<RowT> implements SingleNo
}
/**
- *
+ * CreateHashSpool.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public static <RowT> IndexSpoolNode<RowT> createHashSpool(
ExecutionContext<RowT> ctx,
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/IntersectNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/IntersectNode.java
index 782808b..ccbe3c7 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/IntersectNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/IntersectNode.java
@@ -27,24 +27,15 @@ import org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.GroupKey
* Execution node for INTERSECT operator.
*/
public class IntersectNode<RowT> extends AbstractSetOpNode<RowT> {
- /**
- *
- */
public IntersectNode(ExecutionContext<RowT> ctx, RelDataType rowType, AggregateType type, boolean all,
RowFactory<RowT> rowFactory, int inputsCnt) {
super(ctx, rowType, type, all, rowFactory, new IntersectGrouping<>(ctx, rowFactory, type, all, inputsCnt));
}
- /**
- *
- */
private static class IntersectGrouping<RowT> extends Grouping<RowT> {
/** Inputs count. */
private final int inputsCnt;
- /**
- *
- */
private IntersectGrouping(ExecutionContext<RowT> ctx, RowFactory<RowT> rowFactory, AggregateType type,
boolean all, int inputsCnt) {
super(ctx, rowFactory, type, all);
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/Mailbox.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/Mailbox.java
index 5192389..574f964 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/Mailbox.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/Mailbox.java
@@ -20,25 +20,26 @@ package org.apache.ignite.internal.processors.query.calcite.exec.rel;
import java.util.UUID;
/**
- *
+ * Mailbox interface.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public interface Mailbox<T> extends Node<T> {
/**
- * @return Query ID.
+ * Get query ID.
*/
default UUID queryId() {
return context().queryId();
}
/**
- * @return Fragment ID.
+ * Get fragment ID.
*/
default long fragmentId() {
return context().fragmentId();
}
/**
- * @return Exchange ID.
+ * Get exchange ID.
*/
long exchangeId();
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MergeJoinNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MergeJoinNode.java
index e495c89..fd349c4 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MergeJoinNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MergeJoinNode.java
@@ -31,54 +31,35 @@ import org.apache.ignite.internal.processors.query.calcite.exec.RowHandler;
import org.jetbrains.annotations.NotNull;
/**
- *
+ * MergeJoinNode.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public abstract class MergeJoinNode<RowT> extends AbstractNode<RowT> {
/** Special value to highlights that all row were received and we are not waiting any more. */
protected static final int NOT_WAITING = -1;
- /**
- *
- */
protected final Comparator<RowT> comp;
- /**
- *
- */
protected final RowHandler<RowT> handler;
- /**
- *
- */
protected int requested;
- /**
- *
- */
protected int waitingLeft;
- /**
- *
- */
protected int waitingRight;
- /**
- *
- */
protected final Deque<RowT> rightInBuf = new ArrayDeque<>(inBufSize);
- /**
- *
- */
protected final Deque<RowT> leftInBuf = new ArrayDeque<>(inBufSize);
- /**
- *
- */
protected boolean inLoop;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
+ * @param rowType Rel data type.
* @param comp Join expression.
*/
private MergeJoinNode(ExecutionContext<RowT> ctx, RelDataType rowType, Comparator<RowT> comp) {
@@ -103,9 +84,6 @@ public abstract class MergeJoinNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private void doJoin() throws Exception {
checkState();
@@ -171,9 +149,6 @@ public abstract class MergeJoinNode<RowT> extends AbstractNode<RowT> {
throw new IndexOutOfBoundsException();
}
- /**
- *
- */
private void pushLeft(RowT row) throws Exception {
assert downstream() != null;
assert waitingLeft > 0;
@@ -187,9 +162,6 @@ public abstract class MergeJoinNode<RowT> extends AbstractNode<RowT> {
join();
}
- /**
- *
- */
private void pushRight(RowT row) throws Exception {
assert downstream() != null;
assert waitingRight > 0;
@@ -203,9 +175,6 @@ public abstract class MergeJoinNode<RowT> extends AbstractNode<RowT> {
join();
}
- /**
- *
- */
private void endLeft() throws Exception {
assert downstream() != null;
assert waitingLeft > 0;
@@ -217,9 +186,6 @@ public abstract class MergeJoinNode<RowT> extends AbstractNode<RowT> {
join();
}
- /**
- *
- */
private void endRight() throws Exception {
assert downstream() != null;
assert waitingRight > 0;
@@ -231,27 +197,19 @@ public abstract class MergeJoinNode<RowT> extends AbstractNode<RowT> {
join();
}
- /**
- *
- */
protected Node<RowT> leftSource() {
return sources().get(0);
}
- /**
- *
- */
protected Node<RowT> rightSource() {
return sources().get(1);
}
- /**
- *
- */
protected abstract void join() throws Exception;
/**
- *
+ * Create.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
@NotNull
public static <RowT> MergeJoinNode<RowT> create(ExecutionContext<RowT> ctx, RelDataType outputRowType, RelDataType leftRowType,
@@ -290,34 +248,21 @@ public abstract class MergeJoinNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private static class InnerJoin<RowT> extends MergeJoinNode<RowT> {
- /**
- *
- */
private RowT left;
- /**
- *
- */
private RowT right;
/** Used to store similar rows of rights stream in many-to-many join mode. */
private List<RowT> rightMaterialization;
- /**
- *
- */
private int rightIdx;
- /**
- *
- */
private boolean drainMaterialization;
/**
+ * Constructor.
+ *
* @param ctx Execution context.
* @param rowType Row type.
* @param comp Join expression comparator.
@@ -455,40 +400,27 @@ public abstract class MergeJoinNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private static class LeftJoin<RowT> extends MergeJoinNode<RowT> {
/** Right row factory. */
private final RowHandler.RowFactory<RowT> rightRowFactory;
- /**
- *
- */
private RowT left;
- /**
- *
- */
private RowT right;
/** Used to store similar rows of rights stream in many-to-many join mode. */
private List<RowT> rightMaterialization;
- /**
- *
- */
private int rightIdx;
- /**
- *
- */
private boolean drainMaterialization;
/** Whether current left row was matched (hence pushed to downstream) or not. */
private boolean matched;
/**
+ * Constructor.
+ *
* @param ctx Execution context.
* @param rowType Row type.
* @param comp Join expression comparator.
@@ -648,40 +580,28 @@ public abstract class MergeJoinNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private static class RightJoin<RowT> extends MergeJoinNode<RowT> {
/** Right row factory. */
private final RowHandler.RowFactory<RowT> leftRowFactory;
- /**
- *
- */
private RowT left;
- /**
- *
- */
private RowT right;
/** Used to store similar rows of rights stream in many-to-many join mode. */
private List<RowT> rightMaterialization;
- /**
- *
- */
private int rightIdx;
- /**
- *
- */
private boolean drainMaterialization;
/** Whether current right row was matched (hence pushed to downstream) or not. */
private boolean matched;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
* @param rowType Row type.
* @param comp Join expression comparator.
@@ -857,9 +777,6 @@ public abstract class MergeJoinNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private static class FullOuterJoin<RowT> extends MergeJoinNode<RowT> {
/** Left row factory. */
private final RowHandler.RowFactory<RowT> leftRowFactory;
@@ -867,27 +784,15 @@ public abstract class MergeJoinNode<RowT> extends AbstractNode<RowT> {
/** Right row factory. */
private final RowHandler.RowFactory<RowT> rightRowFactory;
- /**
- *
- */
private RowT left;
- /**
- *
- */
private RowT right;
/** Used to store similar rows of rights stream in many-to-many join mode. */
private List<RowT> rightMaterialization;
- /**
- *
- */
private int rightIdx;
- /**
- *
- */
private boolean drainMaterialization;
/** Whether current left row was matched (hence pushed to downstream) or not. */
@@ -897,6 +802,9 @@ public abstract class MergeJoinNode<RowT> extends AbstractNode<RowT> {
private boolean rightMatched;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
* @param rowType Row type.
* @param comp Join expression comparator.
@@ -1101,21 +1009,15 @@ public abstract class MergeJoinNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private static class SemiJoin<RowT> extends MergeJoinNode<RowT> {
- /**
- *
- */
private RowT left;
- /**
- *
- */
private RowT right;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
* @param rowType Row type.
* @param comp Join expression comparator.
@@ -1187,21 +1089,15 @@ public abstract class MergeJoinNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private static class AntiJoin<RowT> extends MergeJoinNode<RowT> {
- /**
- *
- */
private RowT left;
- /**
- *
- */
private RowT right;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
* @param rowType Row type.
* @param comp Join expression comparator.
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MinusNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MinusNode.java
index 438a5aa..ba08ac8 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MinusNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/MinusNode.java
@@ -27,21 +27,12 @@ import org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.GroupKey
* Execution node for MINUS (EXCEPT) operator.
*/
public class MinusNode<RowT> extends AbstractSetOpNode<RowT> {
- /**
- *
- */
public MinusNode(ExecutionContext<RowT> ctx, RelDataType rowType, AggregateType type, boolean all,
RowFactory<RowT> rowFactory) {
super(ctx, rowType, type, all, rowFactory, new MinusGrouping<>(ctx, rowFactory, type, all));
}
- /**
- *
- */
private static class MinusGrouping<RowT> extends Grouping<RowT> {
- /**
- *
- */
private MinusGrouping(ExecutionContext<RowT> ctx, RowFactory<RowT> rowFactory, AggregateType type, boolean all) {
super(ctx, rowFactory, type, all);
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ModifyNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ModifyNode.java
index 83b7a27..851b0da 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ModifyNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ModifyNode.java
@@ -34,62 +34,38 @@ import org.apache.ignite.table.RecordView;
import org.apache.ignite.table.Tuple;
/**
- *
+ * ModifyNode.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class ModifyNode<RowT> extends AbstractNode<RowT> implements SingleNode<RowT>, Downstream<RowT> {
- /**
- *
- */
protected final TableDescriptor desc;
- /**
- *
- */
private final TableModify.Operation op;
- /**
- *
- */
private final List<String> cols;
- /**
- *
- */
private final RecordView<Tuple> tableView;
- /**
- *
- */
private List<Tuple> tuples = new ArrayList<>(MODIFY_BATCH_SIZE);
- /**
- *
- */
private long updatedRows;
- /**
- *
- */
private int waiting;
- /**
- *
- */
private int requested;
- /**
- *
- */
private boolean inLoop;
- /**
- *
- */
private State state = State.UPDATING;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
+ * @param rowType Rel data type.
* @param desc Table descriptor.
+ * @param op Operation/
* @param cols Update column list.
*/
public ModifyNode(
@@ -182,9 +158,6 @@ public class ModifyNode<RowT> extends AbstractNode<RowT> implements SingleNode<R
return this;
}
- /**
- *
- */
private void tryEnd() throws Exception {
assert downstream() != null;
@@ -212,9 +185,6 @@ public class ModifyNode<RowT> extends AbstractNode<RowT> implements SingleNode<R
}
}
- /**
- *
- */
private void flushTuples(boolean force) {
if (nullOrEmpty(tuples) || !force && tuples.size() < MODIFY_BATCH_SIZE) {
return;
@@ -259,23 +229,11 @@ public class ModifyNode<RowT> extends AbstractNode<RowT> implements SingleNode<R
updatedRows += tuples.size();
}
- /**
- *
- */
private enum State {
- /**
- *
- */
UPDATING,
- /**
- *
- */
UPDATED,
- /**
- *
- */
END
}
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/NestedLoopJoinNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/NestedLoopJoinNode.java
index aabd145..efd1d9f 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/NestedLoopJoinNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/NestedLoopJoinNode.java
@@ -32,54 +32,35 @@ import org.apache.ignite.internal.processors.query.calcite.exec.RowHandler;
import org.jetbrains.annotations.NotNull;
/**
- *
+ * NestedLoopJoinNode.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public abstract class NestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
/** Special value to highlights that all row were received and we are not waiting any more. */
protected static final int NOT_WAITING = -1;
- /**
- *
- */
protected final Predicate<RowT> cond;
- /**
- *
- */
protected final RowHandler<RowT> handler;
- /**
- *
- */
protected int requested;
- /**
- *
- */
protected int waitingLeft;
- /**
- *
- */
protected int waitingRight;
- /**
- *
- */
protected final List<RowT> rightMaterialized = new ArrayList<>(inBufSize);
- /**
- *
- */
protected final Deque<RowT> leftInBuf = new ArrayDeque<>(inBufSize);
- /**
- *
- */
protected boolean inLoop;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
+ * @param rowType Rel data type.
* @param cond Join expression.
*/
private NestedLoopJoinNode(ExecutionContext<RowT> ctx, RelDataType rowType, Predicate<RowT> cond) {
@@ -104,9 +85,6 @@ public abstract class NestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private void doJoin() throws Exception {
checkState();
@@ -172,9 +150,6 @@ public abstract class NestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
throw new IndexOutOfBoundsException();
}
- /**
- *
- */
private void pushLeft(RowT row) throws Exception {
assert downstream() != null;
assert waitingLeft > 0;
@@ -188,9 +163,6 @@ public abstract class NestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
join();
}
- /**
- *
- */
private void pushRight(RowT row) throws Exception {
assert downstream() != null;
assert waitingRight > 0;
@@ -206,9 +178,6 @@ public abstract class NestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private void endLeft() throws Exception {
assert downstream() != null;
assert waitingLeft > 0;
@@ -220,9 +189,6 @@ public abstract class NestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
join();
}
- /**
- *
- */
private void endRight() throws Exception {
assert downstream() != null;
assert waitingRight > 0;
@@ -234,27 +200,19 @@ public abstract class NestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
join();
}
- /**
- *
- */
protected Node<RowT> leftSource() {
return sources().get(0);
}
- /**
- *
- */
protected Node<RowT> rightSource() {
return sources().get(1);
}
- /**
- *
- */
protected abstract void join() throws Exception;
/**
- *
+ * Create.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
@NotNull
public static <RowT> NestedLoopJoinNode<RowT> create(ExecutionContext<RowT> ctx, RelDataType outputRowType,
@@ -293,22 +251,17 @@ public abstract class NestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private static class InnerJoin<RowT> extends NestedLoopJoinNode<RowT> {
- /**
- *
- */
private RowT left;
- /**
- *
- */
private int rightIdx;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
+ * @param rowType Rel data type.
* @param cond Join expression.
*/
private InnerJoin(ExecutionContext<RowT> ctx, RelDataType rowType, Predicate<RowT> cond) {
@@ -324,9 +277,6 @@ public abstract class NestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
super.rewindInternal();
}
- /**
- *
- */
@Override
protected void join() throws Exception {
if (waitingRight == NOT_WAITING) {
@@ -375,9 +325,6 @@ public abstract class NestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private static class LeftJoin<RowT> extends NestedLoopJoinNode<RowT> {
/** Right row factory. */
private final RowHandler.RowFactory<RowT> rightRowFactory;
@@ -385,19 +332,18 @@ public abstract class NestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
/** Whether current left row was matched or not. */
private boolean matched;
- /**
- *
- */
private RowT left;
- /**
- *
- */
private int rightIdx;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
+ * @param rowType Rel data type.
* @param cond Join expression.
+ * @param rightRowFactory Right row factory.
*/
private LeftJoin(
ExecutionContext<RowT> ctx,
@@ -410,9 +356,6 @@ public abstract class NestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
this.rightRowFactory = rightRowFactory;
}
- /**
- *
- */
@Override
protected void rewindInternal() {
matched = false;
@@ -485,36 +428,26 @@ public abstract class NestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private static class RightJoin<RowT> extends NestedLoopJoinNode<RowT> {
/** Right row factory. */
private final RowHandler.RowFactory<RowT> leftRowFactory;
- /**
- *
- */
private BitSet rightNotMatchedIndexes;
- /**
- *
- */
private int lastPushedInd;
- /**
- *
- */
private RowT left;
- /**
- *
- */
private int rightIdx;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
+ * @param rowType Rel data type.
* @param cond Join expression.
+ * @param leftRowFactory Left row factory.
*/
private RightJoin(
ExecutionContext<RowT> ctx,
@@ -626,9 +559,6 @@ public abstract class NestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private static class FullOuterJoin<RowT> extends NestedLoopJoinNode<RowT> {
/** Left row factory. */
private final RowHandler.RowFactory<RowT> leftRowFactory;
@@ -639,29 +569,23 @@ public abstract class NestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
/** Whether current left row was matched or not. */
private boolean leftMatched;
- /**
- *
- */
private BitSet rightNotMatchedIndexes;
- /**
- *
- */
private int lastPushedInd;
- /**
- *
- */
private RowT left;
- /**
- *
- */
private int rightIdx;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
+ * @param rowType Rel data type.
* @param cond Join expression.
+ * @param leftRowFactory Left row factory.
+ * @param rightRowFactory Right row factory.
*/
private FullOuterJoin(ExecutionContext<RowT> ctx, RelDataType rowType, Predicate<RowT> cond,
RowHandler.RowFactory<RowT> leftRowFactory,
@@ -786,22 +710,17 @@ public abstract class NestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private static class SemiJoin<RowT> extends NestedLoopJoinNode<RowT> {
- /**
- *
- */
private RowT left;
- /**
- *
- */
private int rightIdx;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
+ * @param rowType Rel data type.
* @param cond Join expression.
*/
private SemiJoin(ExecutionContext<RowT> ctx, RelDataType rowType, Predicate<RowT> cond) {
@@ -866,31 +785,23 @@ public abstract class NestedLoopJoinNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private static class AntiJoin<RowT> extends NestedLoopJoinNode<RowT> {
- /**
- *
- */
private RowT left;
- /**
- *
- */
private int rightIdx;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
+ * @param rowType Rel data type.
* @param cond Join expression.
*/
private AntiJoin(ExecutionContext<RowT> ctx, RelDataType rowType, Predicate<RowT> cond) {
super(ctx, rowType, cond);
}
- /**
- *
- */
@Override
protected void rewindInternal() {
left = null;
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/Node.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/Node.java
index d76f92e..4e22ea5 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/Node.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/Node.java
@@ -43,6 +43,8 @@ public interface Node<RowT> extends AutoCloseable {
RelDataType rowType();
/**
+ * Returns node downstream.
+ *
* @return Node downstream.
*/
Downstream<RowT> downstream();
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/Outbox.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/Outbox.java
index 369011e..2d27365 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/Outbox.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/Outbox.java
@@ -40,48 +40,28 @@ import org.apache.ignite.lang.IgniteInternalCheckedException;
* A part of exchange.
*/
public class Outbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, SingleNode<RowT>, Downstream<RowT> {
- /**
- *
- */
private final ExchangeService exchange;
- /**
- *
- */
private final MailboxRegistry registry;
- /**
- *
- */
private final long exchangeId;
- /**
- *
- */
private final long targetFragmentId;
- /**
- *
- */
private final Destination<RowT> dest;
- /**
- *
- */
private final Deque<RowT> inBuf = new ArrayDeque<>(inBufSize);
- /**
- *
- */
private final Map<String, Buffer> nodeBuffers = new HashMap<>();
- /**
- *
- */
private int waiting;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
+ * @param rowType Rel data type.
* @param exchange Exchange service.
* @param registry Mailbox registry.
* @param exchangeId Exchange ID.
@@ -112,7 +92,7 @@ public class Outbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, S
}
/**
- * callback method.
+ * Callback method.
*
* @param nodeId Target ID.
* @param batchId Batch ID.
@@ -126,7 +106,8 @@ public class Outbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, S
}
/**
- *
+ * Init.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public void init() {
try {
@@ -219,23 +200,14 @@ public class Outbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, S
return this;
}
- /**
- *
- */
private void sendBatch(String nodeId, int batchId, boolean last, List<RowT> rows) throws IgniteInternalCheckedException {
exchange.sendBatch(nodeId, queryId(), targetFragmentId, exchangeId, batchId, last, rows);
}
- /**
- *
- */
private void sendError(Throwable err) throws IgniteInternalCheckedException {
exchange.sendError(context().originatingNodeId(), queryId(), fragmentId(), err);
}
- /**
- *
- */
private void sendInboxClose(String nodeId) {
try {
exchange.closeInbox(nodeId, queryId(), targetFragmentId, exchangeId);
@@ -244,23 +216,14 @@ public class Outbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, S
}
}
- /**
- *
- */
private Buffer getOrCreateBuffer(String nodeId) {
return nodeBuffers.computeIfAbsent(nodeId, this::createBuffer);
}
- /**
- *
- */
private Buffer createBuffer(String nodeId) {
return new Buffer(nodeId);
}
- /**
- *
- */
private void flush() throws Exception {
while (!inBuf.isEmpty()) {
checkState();
@@ -294,7 +257,8 @@ public class Outbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, S
}
/**
- *
+ * OnNodeLeft.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public void onNodeLeft(String nodeId) {
if (nodeId.equals(context().originatingNodeId())) {
@@ -302,33 +266,15 @@ public class Outbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, S
}
}
- /**
- *
- */
private final class Buffer {
- /**
- *
- */
private final String nodeId;
- /**
- *
- */
private int hwm = -1;
- /**
- *
- */
private int lwm = -1;
- /**
- *
- */
private List<RowT> curr;
- /**
- *
- */
private Buffer(String nodeId) {
this.nodeId = nodeId;
@@ -401,9 +347,6 @@ public class Outbox<RowT> extends AbstractNode<RowT> implements Mailbox<RowT>, S
}
}
- /**
- *
- */
public void close() {
final int currBatchId = hwm;
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ProjectNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ProjectNode.java
index 8288f6f..a46190d 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ProjectNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ProjectNode.java
@@ -24,16 +24,18 @@ import org.apache.calcite.rel.type.RelDataType;
import org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext;
/**
- *
+ * ProjectNode.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class ProjectNode<RowT> extends AbstractNode<RowT> implements SingleNode<RowT>, Downstream<RowT> {
- /**
- *
- */
private final Function<RowT, RowT> prj;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
+ * @param rowType Rel data type.
* @param prj Projection.
*/
public ProjectNode(ExecutionContext<RowT> ctx, RelDataType rowType, Function<RowT, RowT> prj) {
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/RootNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/RootNode.java
index 871133c..205b195 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/RootNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/RootNode.java
@@ -39,53 +39,30 @@ import org.apache.ignite.lang.IgniteInternalException;
* Client iterator.
*/
public class RootNode<RowT> extends AbstractNode<RowT> implements SingleNode<RowT>, Downstream<RowT>, Iterator<RowT> {
- /**
- *
- */
private final ReentrantLock lock = new ReentrantLock();
- /**
- *
- */
private final Condition cond = lock.newCondition();
- /**
- *
- */
private final Runnable onClose;
- /**
- *
- */
private final AtomicReference<Throwable> ex = new AtomicReference<>();
- /**
- *
- */
private final Function<RowT, RowT> converter;
- /**
- *
- */
private int waiting;
- /**
- *
- */
private Deque<RowT> inBuff = new ArrayDeque<>(inBufSize);
- /**
- *
- */
private Deque<RowT> outBuff = new ArrayDeque<>(inBufSize);
- /**
- *
- */
private volatile boolean closed;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
+ * @param rowType Rel data type.
*/
public RootNode(ExecutionContext<RowT> ctx, RelDataType rowType) {
super(ctx, rowType);
@@ -95,7 +72,12 @@ public class RootNode<RowT> extends AbstractNode<RowT> implements SingleNode<Row
}
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
+ * @param rowType Rel data type.
+ * @param onClose Runnable.
*/
public RootNode(ExecutionContext<RowT> ctx, RelDataType rowType, Runnable onClose) {
super(ctx, rowType);
@@ -104,9 +86,6 @@ public class RootNode<RowT> extends AbstractNode<RowT> implements SingleNode<Row
converter = TypeUtils.resultTypeConverter(ctx, rowType);
}
- /**
- *
- */
public UUID queryId() {
return context().queryId();
}
@@ -250,9 +229,6 @@ public class RootNode<RowT> extends AbstractNode<RowT> implements SingleNode<Row
throw new UnsupportedOperationException();
}
- /**
- *
- */
private void exchangeBuffers() {
assert !nullOrEmpty(sources()) && sources().size() == 1;
@@ -289,9 +265,6 @@ public class RootNode<RowT> extends AbstractNode<RowT> implements SingleNode<Row
checkException();
}
- /**
- *
- */
private void checkException() {
Throwable e = ex.get();
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ScanNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ScanNode.java
index eb35f3c..e125d1d 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ScanNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/ScanNode.java
@@ -27,28 +27,20 @@ import org.apache.ignite.internal.processors.query.calcite.util.Commons;
* Scan node.
*/
public class ScanNode<RowT> extends AbstractNode<RowT> implements SingleNode<RowT> {
- /**
- *
- */
private final Iterable<RowT> src;
- /**
- *
- */
private Iterator<RowT> it;
- /**
- *
- */
private int requested;
- /**
- *
- */
private boolean inLoop;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
+ * @param rowType Rel data type.
* @param src Source.
*/
public ScanNode(ExecutionContext<RowT> ctx, RelDataType rowType, Iterable<RowT> src) {
@@ -100,9 +92,6 @@ public class ScanNode<RowT> extends AbstractNode<RowT> implements SingleNode<Row
throw new UnsupportedOperationException();
}
- /**
- *
- */
private void push() throws Exception {
if (isClosed()) {
return;
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SingleNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SingleNode.java
index 51d29e3..9eb74e2 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SingleNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SingleNode.java
@@ -23,19 +23,13 @@ import java.util.List;
import org.jetbrains.annotations.NotNull;
/**
- * A node with a single input
+ * A node with a single input.
*/
public interface SingleNode<RowT> extends Node<RowT> {
- /**
- *
- */
default void register(@NotNull Node<RowT> src) {
register(List.of(src));
}
- /**
- *
- */
default @NotNull Node<RowT> source() {
return first(sources());
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SortAggregateNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SortAggregateNode.java
index c542a69..f526b9e 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SortAggregateNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SortAggregateNode.java
@@ -37,64 +37,36 @@ import org.apache.ignite.internal.processors.query.calcite.exec.exp.agg.Aggregat
import org.apache.ignite.internal.processors.query.calcite.util.Commons;
/**
- *
+ * SortAggregateNode.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class SortAggregateNode<RowT> extends AbstractNode<RowT> implements SingleNode<RowT>, Downstream<RowT> {
- /**
- *
- */
private final AggregateType type;
/** May be {@code null} when there are not accumulators (DISTINCT aggregate node). */
private final Supplier<List<AccumulatorWrapper<RowT>>> accFactory;
- /**
- *
- */
private final RowFactory<RowT> rowFactory;
- /**
- *
- */
private final ImmutableBitSet grpSet;
- /**
- *
- */
private final Comparator<RowT> comp;
- /**
- *
- */
private final Deque<RowT> outBuf = new ArrayDeque<>(inBufSize);
- /**
- *
- */
private RowT prevRow;
- /**
- *
- */
private Group grp;
- /**
- *
- */
private int requested;
- /**
- *
- */
private int waiting;
- /**
- *
- */
private int cmpRes;
/**
- * @param ctx Execution context.
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public SortAggregateNode(
ExecutionContext<RowT> ctx,
@@ -222,16 +194,10 @@ public class SortAggregateNode<RowT> extends AbstractNode<RowT> implements Singl
return this;
}
- /**
- *
- */
private boolean hasAccumulators() {
return accFactory != null;
}
- /**
- *
- */
private Group newGroup(RowT r) {
final Object[] grpKeys = new Object[grpSet.cardinality()];
List<Integer> fldIdxs = grpSet.asList();
@@ -249,9 +215,6 @@ public class SortAggregateNode<RowT> extends AbstractNode<RowT> implements Singl
return grp;
}
- /**
- *
- */
private void doPush() throws Exception {
while (requested > 0 && !outBuf.isEmpty()) {
requested--;
@@ -260,28 +223,13 @@ public class SortAggregateNode<RowT> extends AbstractNode<RowT> implements Singl
}
}
- /**
- *
- */
private class Group {
- /**
- *
- */
private final List<AccumulatorWrapper<RowT>> accumWrps;
- /**
- *
- */
private final RowHandler<RowT> handler;
- /**
- *
- */
private final Object[] grpKeys;
- /**
- *
- */
private Group(Object[] grpKeys) {
this.grpKeys = grpKeys;
@@ -290,9 +238,6 @@ public class SortAggregateNode<RowT> extends AbstractNode<RowT> implements Singl
handler = context().rowHandler();
}
- /**
- *
- */
private void add(RowT row) {
if (type == AggregateType.REDUCE) {
addOnReducer(row);
@@ -301,9 +246,6 @@ public class SortAggregateNode<RowT> extends AbstractNode<RowT> implements Singl
}
}
- /**
- *
- */
private RowT row() {
if (type == AggregateType.MAP) {
return rowOnMapper();
@@ -312,18 +254,12 @@ public class SortAggregateNode<RowT> extends AbstractNode<RowT> implements Singl
}
}
- /**
- *
- */
private void addOnMapper(RowT row) {
for (AccumulatorWrapper<RowT> wrapper : accumWrps) {
wrapper.add(row);
}
}
- /**
- *
- */
private void addOnReducer(RowT row) {
List<Accumulator> accums = hasAccumulators()
? (List<Accumulator>) handler.get(handler.columnCount(row) - 1, row) : Collections.emptyList();
@@ -337,9 +273,6 @@ public class SortAggregateNode<RowT> extends AbstractNode<RowT> implements Singl
}
}
- /**
- *
- */
private RowT rowOnMapper() {
Object[] fields = new Object[grpSet.cardinality() + (accFactory != null ? 1 : 0)];
@@ -357,9 +290,6 @@ public class SortAggregateNode<RowT> extends AbstractNode<RowT> implements Singl
return rowFactory.create(fields);
}
- /**
- *
- */
private RowT rowOnReducer() {
Object[] fields = new Object[grpSet.cardinality() + accumWrps.size()];
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SortNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SortNode.java
index 68ccbe6..b17be23 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SortNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/SortNode.java
@@ -34,15 +34,15 @@ public class SortNode<RowT> extends AbstractNode<RowT> implements SingleNode<Row
/** How many rows are we waiting for from the upstream. {@code -1} means end of stream. */
private int waiting;
- /**
- *
- */
private boolean inLoop;
/** Rows buffer. */
private final PriorityQueue<RowT> rows;
/**
+ * Constructor.
+ *
+ *
* @param ctx Execution context.
* @param comp Rows comparator.
*/
@@ -118,9 +118,6 @@ public class SortNode<RowT> extends AbstractNode<RowT> implements SingleNode<Row
flush();
}
- /**
- *
- */
private void flush() throws Exception {
if (isClosed()) {
return;
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/TableScanNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/TableScanNode.java
index c5554a9..a6b7a85 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/TableScanNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/TableScanNode.java
@@ -43,70 +43,36 @@ public class TableScanNode<RowT> extends AbstractNode<RowT> {
/** Special value to highlights that all row were received and we are not waiting any more. */
private static final int NOT_WAITING = -1;
- /**
- *
- */
private final TableImpl table;
- /**
- *
- */
private final TableDescriptor desc;
- /**
- *
- */
private final RowHandler.RowFactory<RowT> factory;
- /**
- *
- */
private final int[] parts;
- /**
- *
- */
private final Queue<RowT> inBuff = new LinkedBlockingQueue<>(inBufSize);
- /**
- *
- */
private final @Nullable Predicate<RowT> filters;
- /**
- *
- */
private final @Nullable Function<RowT, RowT> rowTransformer;
/** Participating columns. */
private final @Nullable ImmutableBitSet requiredColumns;
- /**
- *
- */
private int requested;
- /**
- *
- */
private int waiting;
- /**
- *
- */
private boolean inLoop;
- /**
- *
- */
private Subscription activeSubscription;
- /**
- *
- */
private int curPartIdx;
/**
+ * Constructor.
+ *
* @param ctx Execution context.
* @param rowType Output type of the current node.
* @param desc Table descriptor this node should scan.
@@ -301,9 +267,6 @@ public class TableScanNode<RowT> extends AbstractNode<RowT> {
}
}
- /**
- *
- */
private RowT convert(BinaryRow binRow) {
final org.apache.ignite.internal.schema.row.Row wrapped = table.schemaView().resolve(binRow);
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/TableSpoolNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/TableSpoolNode.java
index 7fd09af..9083a21 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/TableSpoolNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/TableSpoolNode.java
@@ -41,18 +41,24 @@ public class TableSpoolNode<RowT> extends AbstractNode<RowT> implements SingleNo
private final List<RowT> rows;
/**
- * If {@code true} this spool should emit rows as soon as it stored. If {@code false} the spool have to collect all rows from underlying
- * input.
+ * If {@code true} this spool should emit rows as soon as it stored. If {@code false} the spool have to collect all
+ * rows from underlying input.
*/
private final boolean lazyRead;
/**
- * Flag indicates that spool pushes row to downstream. Need to check a case when a downstream produces requests on push.
+ * Flag indicates that spool pushes row to downstream. Need to check a case when a downstream produces requests on
+ * push.
*/
private boolean inLoop;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
+ * @param rowType Rel data type.
+ * @param lazyRead Lazy read flag.
*/
public TableSpoolNode(ExecutionContext<RowT> ctx, RelDataType rowType, boolean lazyRead) {
super(ctx, rowType);
@@ -102,9 +108,6 @@ public class TableSpoolNode<RowT> extends AbstractNode<RowT> implements SingleNo
}
}
- /**
- *
- */
private void doPush() throws Exception {
if (isClosed()) {
return;
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/UnionAllNode.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/UnionAllNode.java
index 46f1da3..3b2def2 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/UnionAllNode.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/rel/UnionAllNode.java
@@ -23,21 +23,20 @@ import org.apache.calcite.rel.type.RelDataType;
import org.apache.ignite.internal.processors.query.calcite.exec.ExecutionContext;
/**
- *
+ * UnionAllNode.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class UnionAllNode<RowT> extends AbstractNode<RowT> implements Downstream<RowT> {
- /**
- *
- */
private int curSrc;
- /**
- *
- */
private int waiting;
/**
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param ctx Execution context.
+ * @param rowType Rel data type.
*/
public UnionAllNode(ExecutionContext<RowT> ctx, RelDataType rowType) {
super(ctx, rowType);
@@ -99,9 +98,6 @@ public class UnionAllNode<RowT> extends AbstractNode<RowT> implements Downstream
waiting = 0;
}
- /**
- *
- */
private Node<RowT> source() {
return sources().get(curSrc);
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/externalize/RelInputEx.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/externalize/RelInputEx.java
index 1d03d6e..8f2893f 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/externalize/RelInputEx.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/externalize/RelInputEx.java
@@ -21,10 +21,14 @@ import org.apache.calcite.rel.RelCollation;
import org.apache.calcite.rel.RelInput;
/**
- *
+ * RelInputEx interface.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public interface RelInputEx extends RelInput {
/**
+ * GetCollation.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
+ *
* @param tag Tag.
* @return A collation value.
*/
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/externalize/RelJson.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/externalize/RelJson.java
index 0fdbee3..da9ffc5 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/externalize/RelJson.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/externalize/RelJson.java
@@ -114,14 +114,8 @@ import org.apache.ignite.lang.IgniteException;
*/
@SuppressWarnings({"rawtypes", "unchecked"})
class RelJson {
- /**
- *
- */
private final RelOptCluster cluster;
- /**
- *
- */
@SuppressWarnings("PublicInnerClass")
@FunctionalInterface
public interface RelFactory extends Function<RelInput, RelNode> {
@@ -130,15 +124,9 @@ class RelJson {
RelNode apply(RelInput input);
}
- /**
- *
- */
private static final LoadingCache<String, RelFactory> FACTORIES_CACHE = Caffeine.newBuilder()
.build(RelJson::relFactory);
- /**
- *
- */
private static RelFactory relFactory(String typeName) {
Class<?> clazz = null;
@@ -173,11 +161,8 @@ class RelJson {
return Commons.compile(RelFactory.class, Expressions.toString(asList(declaration), "\n", true));
}
- /**
- *
- */
private static final Map<String, Enum<?>> ENUM_BY_NAME;
-
+
static {
// Build a mapping from enum constants (e.g. LEADING) to the enum
// that contains them (e.g. SqlTrimFunction.Flag). If there two
@@ -206,9 +191,6 @@ class RelJson {
ENUM_BY_NAME = Map.copyOf(enumByName);
}
- /**
- *
- */
private static void register(Map<String, Enum<?>> map, Class<? extends Enum> aclass) {
String preffix = aclass.getSimpleName() + "#";
for (Enum enumConstant : aclass.getEnumConstants()) {
@@ -216,9 +198,6 @@ class RelJson {
}
}
- /**
- *
- */
private static Class<?> classForName(String typeName, boolean skipNotFound) {
try {
return IgniteUtils.forName(typeName, igniteClassLoader());
@@ -231,9 +210,6 @@ class RelJson {
return null;
}
- /**
- *
- */
private static final List<String> PACKAGES =
List.of(
"org.apache.ignite.internal.processors.query.calcite.rel.",
@@ -246,22 +222,17 @@ class RelJson {
"org.apache.calcite.adapter.jdbc.JdbcRules$");
/**
- *
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
RelJson(RelOptCluster cluster) {
this.cluster = cluster;
}
- /**
- *
- */
Function<RelInput, RelNode> factory(String type) {
return FACTORIES_CACHE.get(type);
}
- /**
- *
- */
String classToTypeName(Class<? extends RelNode> cls) {
if (IgniteRel.class.isAssignableFrom(cls)) {
return cls.getSimpleName();
@@ -279,9 +250,6 @@ class RelJson {
return canonicalName;
}
- /**
- *
- */
Object toJson(Object value) {
if (value == null
|| value instanceof Number
@@ -333,26 +301,20 @@ class RelJson {
+ value + " (type " + value.getClass().getCanonicalName() + ")");
}
}
-
- /**
- *
- */
+
private Object toJson(Enum<?> enum0) {
String key = enum0.getDeclaringClass().getSimpleName() + "#" + enum0.name();
-
+
if (ENUM_BY_NAME.get(key) == enum0) {
return key;
}
-
+
Map<String, Object> map = map();
map.put("class", enum0.getDeclaringClass().getName());
map.put("name", enum0.name());
return map;
}
-
- /**
- *
- */
+
private Object toJson(AggregateCall node) {
Map<String, Object> map = map();
map.put("agg", toJson(node.getAggregation()));
@@ -363,10 +325,7 @@ class RelJson {
map.put("name", node.getName());
return map;
}
-
- /**
- *
- */
+
private Object toJson(RelDataType node) {
if (node instanceof JavaType) {
Map<String, Object> map = map();
@@ -374,7 +333,7 @@ class RelJson {
if (node.isNullable()) {
map.put("nullable", true);
}
-
+
return map;
}
if (node.isStruct()) {
@@ -403,10 +362,7 @@ class RelJson {
return map;
}
}
-
- /**
- *
- */
+
private Object toJson(RelDataTypeField node) {
Map<String, Object> map;
if (node.getType().isStruct()) {
@@ -418,21 +374,15 @@ class RelJson {
map.put("name", node.getName());
return map;
}
-
- /**
- *
- */
+
private Object toJson(CorrelationId node) {
return node.getId();
}
-
- /**
- *
- */
+
private Object toJson(RexNode node) {
// removes calls to SEARCH and the included Sarg and converts them to comparisons
node = RexUtil.expandSearch(cluster.getRexBuilder(), null, node);
-
+
Map<String, Object> map;
switch (node.getKind()) {
case FIELD_ACCESS:
@@ -440,7 +390,7 @@ class RelJson {
RexFieldAccess fieldAccess = (RexFieldAccess) node;
map.put("field", fieldAccess.getField().getName());
map.put("expr", toJson(fieldAccess.getReferenceExpr()));
-
+
return map;
case LITERAL:
RexLiteral literal = (RexLiteral) node;
@@ -448,13 +398,13 @@ class RelJson {
map = map();
map.put("literal", toJson(value));
map.put("type", toJson(node.getType()));
-
+
return map;
case INPUT_REF:
map = map();
map.put("input", ((RexSlot) node).getIndex());
map.put("name", ((RexVariable) node).getName());
-
+
return map;
case DYNAMIC_PARAM:
map = map();
@@ -462,20 +412,20 @@ class RelJson {
map.put("name", ((RexVariable) node).getName());
map.put("type", toJson(node.getType()));
map.put("dynamic", true);
-
+
return map;
case LOCAL_REF:
map = map();
map.put("input", ((RexSlot) node).getIndex());
map.put("name", ((RexVariable) node).getName());
map.put("type", toJson(node.getType()));
-
+
return map;
case CORREL_VARIABLE:
map = map();
map.put("correl", ((RexVariable) node).getName());
map.put("type", toJson(node.getType()));
-
+
return map;
default:
if (node instanceof RexCall) {
@@ -483,17 +433,17 @@ class RelJson {
map = map();
map.put("op", toJson(call.getOperator()));
List<Object> list = list();
-
+
for (RexNode operand : call.getOperands()) {
list.add(toJson(operand));
}
-
+
map.put("operands", list);
-
+
if (node.getKind() == SqlKind.CAST) {
map.put("type", toJson(node.getType()));
}
-
+
if (call.getOperator() instanceof SqlFunction) {
if (((SqlFunction) call.getOperator()).getFunctionType().isUserDefined()) {
SqlOperator op = call.getOperator();
@@ -503,23 +453,20 @@ class RelJson {
map.put("dynamic", op.isDynamicFunction());
}
}
-
+
if (call instanceof RexOver) {
RexOver over = (RexOver) call;
map.put("distinct", over.isDistinct());
map.put("type", toJson(node.getType()));
map.put("window", toJson(over.getWindow()));
}
-
+
return map;
}
throw new UnsupportedOperationException("unknown rex " + node);
}
}
-
- /**
- *
- */
+
private Object toJson(RexWindow window) {
Map<String, Object> map = map();
if (!window.partitionKeys.isEmpty()) {
@@ -545,19 +492,16 @@ class RelJson {
}
return map;
}
-
- /**
- *
- */
+
private Object toJson(DistributionTrait distribution) {
Type type = distribution.getType();
-
+
switch (type) {
case ANY:
case BROADCAST_DISTRIBUTED:
case RANDOM_DISTRIBUTED:
case SINGLETON:
-
+
return type.shortName;
case HASH_DISTRIBUTED:
Map<String, Object> map = map();
@@ -565,18 +509,15 @@ class RelJson {
for (Integer key : distribution.getKeys()) {
keys.add(toJson(key));
}
-
+
map.put("keys", keys);
-
+
return map;
default:
throw new AssertionError("Unexpected distribution type.");
}
}
-
- /**
- *
- */
+
private Object toJson(RelCollationImpl node) {
List<Object> list = list();
for (RelFieldCollation fieldCollation : node.getFieldCollations()) {
@@ -588,10 +529,7 @@ class RelJson {
}
return list;
}
-
- /**
- *
- */
+
private Object toJson(RexFieldCollation collation) {
Map<String, Object> map = map();
map.put("expr", toJson(collation.left));
@@ -599,10 +537,7 @@ class RelJson {
map.put("null-direction", toJson(collation.getNullDirection()));
return map;
}
-
- /**
- *
- */
+
private Object toJson(RexWindowBound windowBound) {
Map<String, Object> map = map();
if (windowBound.isCurrentRow()) {
@@ -615,10 +550,7 @@ class RelJson {
}
return map;
}
-
- /**
- *
- */
+
private Object toJson(SqlOperator operator) {
// User-defined operators are not yet handled.
Map map = map();
@@ -628,9 +560,6 @@ class RelJson {
return map;
}
- /**
- *
- */
RelCollation toCollation(List<Map<String, Object>> jsonFieldCollations) {
if (jsonFieldCollations == null) {
return RelCollations.EMPTY;
@@ -643,9 +572,6 @@ class RelJson {
return RelCollations.of(fieldCollations);
}
- /**
- *
- */
IgniteDistribution toDistribution(Object distribution) {
if (distribution instanceof String) {
switch ((String) distribution) {
@@ -672,9 +598,6 @@ class RelJson {
return IgniteDistributions.hash((List<Integer>) map.get("keys"), DistributionFunction.hash());
}
- /**
- *
- */
RelDataType toType(RelDataTypeFactory typeFactory, Object o) {
if (o instanceof List) {
List<Map<String, Object>> jsonList = (List<Map<String, Object>>) o;
@@ -734,9 +657,6 @@ class RelJson {
}
}
- /**
- *
- */
RexNode toRex(RelInput relInput, Object o) {
RelOptCluster cluster = relInput.getCluster();
RexBuilder rexBuilder = cluster.getRexBuilder();
@@ -865,9 +785,6 @@ class RelJson {
}
}
- /**
- *
- */
SqlOperator toOp(Map<String, Object> map) {
// in case different operator has the same kind, check with both name and kind.
String name = map.get("name").toString();
@@ -895,30 +812,18 @@ class RelJson {
return null;
}
- /**
- *
- */
<T> List<T> list() {
return new ArrayList<>();
}
- /**
- *
- */
<T> Set<T> set() {
return new LinkedHashSet<>();
}
- /**
- *
- */
<T> Map<String, T> map() {
return new LinkedHashMap<>();
}
- /**
- *
- */
private <T extends Enum<T>> T toEnum(Object o) {
if (o instanceof Map) {
Map<String, Object> map = (Map<String, Object>) o;
@@ -933,9 +838,6 @@ class RelJson {
return (T) ENUM_BY_NAME.get(name);
}
- /**
- *
- */
private RelFieldCollation toFieldCollation(Map<String, Object> map) {
Integer field = (Integer) map.get("field");
Direction direction = toEnum(map.get("direction"));
@@ -943,9 +845,6 @@ class RelJson {
return new RelFieldCollation(field, direction, nullDirection);
}
- /**
- *
- */
private List<RexFieldCollation> toRexFieldCollationList(RelInput relInput, List<Map<String, Object>> order) {
if (order == null) {
return null;
@@ -968,9 +867,6 @@ class RelJson {
return list;
}
- /**
- *
- */
private RexWindowBound toRexWindowBound(RelInput input, Map<String, Object> map) {
if (map == null) {
return null;
@@ -1002,9 +898,6 @@ class RelJson {
}
}
- /**
- *
- */
private List<RexNode> toRexList(RelInput relInput, List<?> operands) {
List<RexNode> list = new ArrayList<>();
for (Object operand : operands) {
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/externalize/RelJsonReader.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/externalize/RelJsonReader.java
index 5617c34..f2ab7b2 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/externalize/RelJsonReader.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/externalize/RelJsonReader.java
@@ -51,48 +51,29 @@ import org.apache.ignite.internal.processors.query.calcite.util.Commons;
import org.apache.ignite.lang.IgniteException;
/**
- *
+ * RelJsonReader.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public class RelJsonReader {
- /**
- *
- */
private static final TypeReference<LinkedHashMap<String, Object>> TYPE_REF = new TypeReference<>() {
};
- /**
- *
- */
private final ObjectMapper mapper = new ObjectMapper().enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS);
- /**
- *
- */
private final RelOptCluster cluster;
- /**
- *
- */
private final RelOptSchema relOptSchema;
- /**
- *
- */
private final RelJson relJson;
- /**
- *
- */
private final Map<String, RelNode> relMap = new LinkedHashMap<>();
- /**
- *
- */
private RelNode lastRel;
/**
- *
+ * FromJson.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public static <T extends RelNode> T fromJson(PlanningContext ctx, String json) {
RelJsonReader reader = new RelJsonReader(ctx.cluster(), ctx.catalogReader());
@@ -101,7 +82,8 @@ public class RelJsonReader {
}
/**
- *
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public RelJsonReader(RelOptCluster cluster, RelOptSchema relOptSchema) {
this.cluster = cluster;
@@ -111,7 +93,8 @@ public class RelJsonReader {
}
/**
- *
+ * Read.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public RelNode read(String s) {
try {
@@ -125,18 +108,12 @@ public class RelJsonReader {
}
}
- /**
- *
- */
private void readRels(List<Map<String, Object>> jsonRels) {
for (Map<String, Object> jsonRel : jsonRels) {
readRel(jsonRel);
}
}
- /**
- *
- */
private void readRel(Map<String, Object> jsonRel) {
String id = (String) jsonRel.get("id");
String type = (String) jsonRel.get("relOp");
@@ -146,18 +123,9 @@ public class RelJsonReader {
lastRel = rel;
}
- /**
- *
- */
private class RelInputImpl implements RelInputEx {
- /**
- *
- */
private final Map<String, Object> jsonRel;
- /**
- *
- */
private RelInputImpl(Map<String, Object> jsonRel) {
this.jsonRel = jsonRel;
}
@@ -365,9 +333,6 @@ public class RelJsonReader {
return builder.build();
}
- /**
- *
- */
private RelNode lookupInput(String jsonInput) {
RelNode node = relMap.get(jsonInput);
if (node == null) {
@@ -377,9 +342,6 @@ public class RelJsonReader {
return node;
}
- /**
- *
- */
private ImmutableList<RexLiteral> getTuple(List jsonTuple) {
ImmutableList.Builder<RexLiteral> builder =
ImmutableList.builder();
@@ -391,9 +353,6 @@ public class RelJsonReader {
return builder.build();
}
- /**
- *
- */
private AggregateCall toAggCall(Map<String, Object> jsonAggCall) {
Map<String, Object> aggMap = (Map) jsonAggCall.get("agg");
SqlAggFunction aggregation = (SqlAggFunction) relJson.toOp(aggMap);
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/externalize/RelJsonWriter.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/externalize/RelJsonWriter.java
index 64536dd..36215db 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/externalize/RelJsonWriter.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/externalize/RelJsonWriter.java
@@ -39,44 +39,24 @@ import org.apache.ignite.lang.IgniteException;
* @see RelJsonReader
*/
public class RelJsonWriter implements RelWriter {
- /**
- *
- */
private static final boolean PRETTY_PRINT = false;
// TODO: IgniteSystemProperties.getBoolean("IGNITE_CALCITE_REL_JSON_PRETTY_PRINT", false);
- /**
- *
- */
private final RelJson relJson;
- /**
- *
- */
private final List<Object> relList = new ArrayList<>();
- /**
- *
- */
private final Map<RelNode, String> relIdMap = new IdentityHashMap<>();
- /**
- *
- */
private final boolean pretty;
- /**
- *
- */
private String previousId;
- /**
- *
- */
private List<Pair<String, Object>> items = new ArrayList<>();
/**
- *
+ * Write to json string.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public static String toJson(RelNode rel) {
RelJsonWriter writer = new RelJsonWriter(rel.getCluster(), PRETTY_PRINT);
@@ -86,7 +66,8 @@ public class RelJsonWriter implements RelWriter {
}
/**
- *
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public RelJsonWriter(RelOptCluster cluster, boolean pretty) {
this.pretty = pretty;
@@ -129,7 +110,8 @@ public class RelJsonWriter implements RelWriter {
}
/**
- *
+ * AsString.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public String asString() {
try {
@@ -150,9 +132,6 @@ public class RelJsonWriter implements RelWriter {
}
}
- /**
- *
- */
private void explain_(RelNode rel, List<Pair<String, Object>> values) {
final Map<String, Object> map = relJson.map();
@@ -180,9 +159,6 @@ public class RelJsonWriter implements RelWriter {
previousId = id;
}
- /**
- *
- */
private List<Object> explainInputs(List<RelNode> inputs) {
final List<Object> list = relJson.list();
for (RelNode input : inputs) {
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/ErrorMessage.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/ErrorMessage.java
index a428ad1..972a817 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/ErrorMessage.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/ErrorMessage.java
@@ -23,22 +23,23 @@ import org.apache.ignite.network.NetworkMessage;
import org.apache.ignite.network.annotations.Transferable;
/**
- *
+ * ErrorMessage interface.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
@Transferable(value = SqlQueryMessageGroup.ERROR_MESSAGE, autoSerializable = false)
public interface ErrorMessage extends NetworkMessage, Serializable {
/**
- * @return Query ID.
+ * Get query ID.
*/
UUID queryId();
/**
- * @return Fragment ID.
+ * Get fragment ID.
*/
long fragmentId();
/**
- * @return Error.
+ * Get error.
*/
Throwable error();
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/ExecutionContextAwareMessage.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/ExecutionContextAwareMessage.java
index 31a184c..765a047 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/ExecutionContextAwareMessage.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/ExecutionContextAwareMessage.java
@@ -26,12 +26,12 @@ import org.apache.ignite.network.NetworkMessage;
*/
public interface ExecutionContextAwareMessage extends NetworkMessage, Serializable {
/**
- * @return Query ID.
+ * Get query ID.
*/
UUID queryId();
/**
- * @return Fragment ID.
+ * Get fragment ID.
*/
long fragmentId();
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/InboxCloseMessage.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/InboxCloseMessage.java
index f572946..0802625 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/InboxCloseMessage.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/InboxCloseMessage.java
@@ -23,22 +23,23 @@ import org.apache.ignite.network.NetworkMessage;
import org.apache.ignite.network.annotations.Transferable;
/**
- *
+ * InboxCloseMessage interface.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
@Transferable(value = SqlQueryMessageGroup.INBOX_CLOSE_MESSAGE)
public interface InboxCloseMessage extends NetworkMessage, Serializable {
/**
- * @return Query ID.
+ * Get query ID.
*/
UUID queryId();
/**
- * @return Fragment ID.
+ * Get fragment ID.
*/
long fragmentId();
/**
- * @return Exchange ID.
+ * Get exchange ID.
*/
long exchangeId();
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageListener.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageListener.java
index cb50dc3..6fa9678 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageListener.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageListener.java
@@ -20,10 +20,13 @@ package org.apache.ignite.internal.processors.query.calcite.message;
import org.apache.ignite.network.NetworkMessage;
/**
- *
+ * MessageListener interface.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public interface MessageListener {
/**
+ * OnMessage.
+ *
* @param nodeId Sender node ID.
* @param msg Message.
*/
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageService.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageService.java
index dff1d9f..8e85615 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageService.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageService.java
@@ -22,7 +22,8 @@ import org.apache.ignite.lang.IgniteInternalCheckedException;
import org.apache.ignite.network.NetworkMessage;
/**
- *
+ * MessageService interface.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public interface MessageService extends LifecycleAware {
/**
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageServiceImpl.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageServiceImpl.java
index 39cf2a3..ff3f469 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageServiceImpl.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/MessageServiceImpl.java
@@ -35,7 +35,8 @@ import org.apache.ignite.network.NetworkMessage;
import org.apache.ignite.network.TopologyService;
/**
- *
+ * MessageServiceImpl.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class MessageServiceImpl implements MessageService {
private static final UUID QUERY_ID_STUB = UUID.randomUUID();
@@ -46,23 +47,15 @@ public class MessageServiceImpl implements MessageService {
private final MessagingService messagingSrvc;
- /**
- *
- */
private final String locNodeId;
- /**
- *
- */
private final QueryTaskExecutor taskExecutor;
- /**
- *
- */
private volatile Map<Short, MessageListener> lsnrs;
/**
- *
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public MessageServiceImpl(
TopologyService topSrvc,
@@ -125,9 +118,6 @@ public class MessageServiceImpl implements MessageService {
.anyMatch(id -> id.equals(nodeId));
}
- /**
- *
- */
protected void onMessage(String nodeId, NetworkMessage msg) {
if (msg instanceof ExecutionContextAwareMessage) {
ExecutionContextAwareMessage msg0 = (ExecutionContextAwareMessage) msg;
@@ -141,9 +131,6 @@ public class MessageServiceImpl implements MessageService {
}
}
- /**
- *
- */
private void onMessage(NetworkMessage msg, NetworkAddress addr, String correlationId) {
assert msg.groupType() == GROUP_TYPE : "unexpected message group grpType=" + msg.groupType();
@@ -158,9 +145,6 @@ public class MessageServiceImpl implements MessageService {
onMessage(node.id(), msg);
}
- /**
- *
- */
private void onMessageInternal(String nodeId, NetworkMessage msg) {
MessageListener lsnr = Objects.requireNonNull(
lsnrs.get(msg.messageType()),
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/OutboxCloseMessage.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/OutboxCloseMessage.java
index aaf389f..4a66cbe 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/OutboxCloseMessage.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/OutboxCloseMessage.java
@@ -23,22 +23,23 @@ import org.apache.ignite.network.NetworkMessage;
import org.apache.ignite.network.annotations.Transferable;
/**
- *
+ * OutboxCloseMessage interface.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
@Transferable(value = SqlQueryMessageGroup.OUTBOX_CLOSE_MESSAGE)
public interface OutboxCloseMessage extends NetworkMessage, Serializable {
/**
- * @return Query ID.
+ * Get query ID.
*/
UUID queryId();
/**
- * @return Fragment ID.
+ * Get fragment ID.
*/
long fragmentId();
/**
- * @return Exchange ID.
+ * Get exchange ID.
*/
long exchangeId();
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryBatchAcknowledgeMessage.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryBatchAcknowledgeMessage.java
index 54dd27c..a0ffd9e 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryBatchAcknowledgeMessage.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryBatchAcknowledgeMessage.java
@@ -20,17 +20,18 @@ package org.apache.ignite.internal.processors.query.calcite.message;
import org.apache.ignite.network.annotations.Transferable;
/**
- *
+ * QueryBatchAcknowledgeMessage interface.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
@Transferable(value = SqlQueryMessageGroup.QUERY_BATCH_ACK)
public interface QueryBatchAcknowledgeMessage extends ExecutionContextAwareMessage {
/**
- * @return Exchange ID.
+ * Get exchange ID.
*/
long exchangeId();
/**
- * @return Batch ID.
+ * Get batch ID.
*/
int batchId();
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryBatchMessage.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryBatchMessage.java
index 5d9ffe8..bff9600 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryBatchMessage.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryBatchMessage.java
@@ -21,27 +21,28 @@ import java.util.List;
import org.apache.ignite.network.annotations.Transferable;
/**
- *
+ * QueryBatchMessage interface.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
@Transferable(value = SqlQueryMessageGroup.QUERY_BATCH_MESSAGE, autoSerializable = false)
public interface QueryBatchMessage extends ExecutionContextAwareMessage {
/**
- * @return Exchange ID.
+ * Get exchange ID.
*/
long exchangeId();
/**
- * @return Batch ID.
+ * Get batch ID.
*/
int batchId();
/**
- * @return Last batch flag.
+ * Get last batch flag.
*/
boolean last();
/**
- * @return Rows.
+ * Get rows.
*/
List<Object> rows();
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryStartRequest.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryStartRequest.java
index bb6b710..7c8ec68 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryStartRequest.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryStartRequest.java
@@ -21,32 +21,32 @@ import org.apache.ignite.internal.processors.query.calcite.metadata.FragmentDesc
import org.apache.ignite.network.annotations.Transferable;
/**
- *
+ * QueryStartRequest interface.
*/
@Transferable(value = SqlQueryMessageGroup.QUERY_START_REQUEST, autoSerializable = false)
public interface QueryStartRequest extends ExecutionContextAwareMessage {
/**
- * @return Schema name.
+ * Get schema name.
*/
String schema();
/**
- * @return Fragment description.
+ * Get fragment description.
*/
FragmentDescription fragmentDescription();
/**
- * @return Topology version.
+ * Get topology version.
*/
long topologyVersion();
/**
- * @return Fragment plan.
+ * Get fragment plan.
*/
String root();
/**
- * @return Query parameters.
+ * Get query parameters.
*/
Object[] parameters();
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryStartResponse.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryStartResponse.java
index 72d81f2..605f4a1 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryStartResponse.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/message/QueryStartResponse.java
@@ -23,22 +23,23 @@ import org.apache.ignite.network.NetworkMessage;
import org.apache.ignite.network.annotations.Transferable;
/**
- *
+ * QueryStartResponse interface.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
@Transferable(value = SqlQueryMessageGroup.QUERY_START_RESPONSE, autoSerializable = false)
public interface QueryStartResponse extends NetworkMessage, Serializable {
/**
- * @return Query ID.
+ * Get query ID.
*/
UUID queryId();
/**
- * @return Fragment ID.
+ * Get fragment ID.
*/
long fragmentId();
/**
- * @return Error.
+ * Get error.
*/
Throwable error();
}
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/AffinityService.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/AffinityService.java
index dd78685..5baa5b0 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/AffinityService.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/AffinityService.java
@@ -20,7 +20,8 @@ package org.apache.ignite.internal.processors.query.calcite.metadata;
import java.util.function.ToIntFunction;
/**
- *
+ * AffinityService interface.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public interface AffinityService {
/**
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/ColocationGroup.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/ColocationGroup.java
index 9c3aaa2..5f57785 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/ColocationGroup.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/ColocationGroup.java
@@ -35,53 +35,46 @@ import org.apache.ignite.internal.util.IgniteIntList;
import org.jetbrains.annotations.NotNull;
/**
- *
+ * ColocationGroup.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class ColocationGroup implements Serializable {
- /**
- *
- */
private static final int SYNTHETIC_PARTITIONS_COUNT = 512;
// TODO: IgniteSystemProperties.getInteger("IGNITE_CALCITE_SYNTHETIC_PARTITIONS_COUNT", 512);
- /**
- *
- */
private List<Long> sourceIds;
- /**
- *
- */
private List<String> nodeIds;
- /**
- *
- */
private List<List<String>> assignments;
/**
- *
+ * ForNodes.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public static ColocationGroup forNodes(List<String> nodeIds) {
return new ColocationGroup(null, nodeIds, null);
}
/**
- *
+ * ForAssignments.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public static ColocationGroup forAssignments(List<List<String>> assignments) {
return new ColocationGroup(null, null, assignments);
}
/**
- *
+ * ForSourceId.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public static ColocationGroup forSourceId(long sourceId) {
return new ColocationGroup(Collections.singletonList(sourceId), null, null);
}
/**
- *
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
private ColocationGroup(List<Long> sourceIds, List<String> nodeIds, List<List<String>> assignments) {
this.sourceIds = sourceIds;
@@ -90,30 +83,30 @@ public class ColocationGroup implements Serializable {
}
/**
- * @return Lists of colocation group sources.
+ * Get lists of colocation group sources.
*/
public List<Long> sourceIds() {
return sourceIds == null ? Collections.emptyList() : sourceIds;
}
/**
- * @return Lists of nodes capable to execute a query fragment for what the mapping is calculated.
+ * Get lists of nodes capable to execute a query fragment for what the mapping is calculated.
*/
public List<String> nodeIds() {
return nodeIds == null ? Collections.emptyList() : nodeIds;
}
/**
- * @return List of partitions (index) and nodes (items) having an appropriate partition in OWNING state, calculated for distributed
- * tables, involved in query execution.
+ * Get list of partitions (index) and nodes (items) having an appropriate partition in OWNING state, calculated for
+ * distributed tables, involved in query execution.
*/
public List<List<String>> assignments() {
return assignments == null ? Collections.emptyList() : assignments;
}
/**
- * Prunes involved partitions (hence nodes, involved in query execution) on the basis of filter, its distribution, query parameters and
- * original nodes mapping.
+ * Prunes involved partitions (hence nodes, involved in query execution) on the basis of filter, its distribution,
+ * query parameters and original nodes mapping.
*
* @param rel Filter.
* @return Resulting nodes mapping.
@@ -123,7 +116,8 @@ public class ColocationGroup implements Serializable {
}
/**
- *
+ * Belongs.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public boolean belongs(long sourceId) {
return sourceIds != null && sourceIds.contains(sourceId);
@@ -134,8 +128,8 @@ public class ColocationGroup implements Serializable {
*
* @param other Mapping to merge with.
* @return Merged nodes mapping.
- * @throws ColocationMappingException If involved nodes intersection is empty, hence there is no nodes capable to execute being
- * calculated fragment.
+ * @throws ColocationMappingException If involved nodes intersection is empty, hence there is no nodes capable to
+ * execute being calculated fragment.
*/
public ColocationGroup colocate(ColocationGroup other) throws ColocationMappingException {
List<Long> sourceIds;
@@ -201,7 +195,8 @@ public class ColocationGroup implements Serializable {
}
/**
- *
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public ColocationGroup finalaze() {
if (assignments == null && nodeIds == null) {
@@ -226,15 +221,13 @@ public class ColocationGroup implements Serializable {
}
/**
- *
+ * MapToNodes.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public ColocationGroup mapToNodes(List<String> nodeIds) {
return !nullOrEmpty(this.nodeIds) ? this : forNodes0(nodeIds);
}
- /**
- *
- */
@NotNull
private ColocationGroup forNodes0(List<String> nodeIds) {
List<List<String>> assignments = new ArrayList<>(SYNTHETIC_PARTITIONS_COUNT);
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/ColocationMappingException.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/ColocationMappingException.java
index a1be2b7..db1573a 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/ColocationMappingException.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/ColocationMappingException.java
@@ -18,10 +18,13 @@
package org.apache.ignite.internal.processors.query.calcite.metadata;
/**
- *
+ * ColocationMappingException.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class ColocationMappingException extends Exception {
/**
+ * Constructor.
+ *
* @param message Message.
*/
public ColocationMappingException(String message) {
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/FragmentDescription.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/FragmentDescription.java
index 469e144..2bd9c60 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/FragmentDescription.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/FragmentDescription.java
@@ -22,37 +22,28 @@ import java.io.Serializable;
import java.util.List;
/**
- *
+ * FragmentDescription.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class FragmentDescription implements Serializable {
- /**
- *
- */
private long fragmentId;
- /**
- *
- */
private FragmentMapping mapping;
- /**
- *
- */
private ColocationGroup target;
- /**
- *
- */
private Long2ObjectOpenHashMap<List<String>> remoteSources;
/**
- *
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public FragmentDescription() {
}
/**
- *
+ * Constructor.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public FragmentDescription(long fragmentId, FragmentMapping mapping, ColocationGroup target,
Long2ObjectOpenHashMap<List<String>> remoteSources) {
@@ -63,35 +54,35 @@ public class FragmentDescription implements Serializable {
}
/**
- *
+ * Get fragment id.
*/
public long fragmentId() {
return fragmentId;
}
/**
- *
+ * Get node ids.
*/
public List<String> nodeIds() {
return mapping.nodeIds();
}
/**
- *
+ * Get target.
*/
public ColocationGroup target() {
return target;
}
/**
- *
+ * Get remotes.
*/
public Long2ObjectOpenHashMap<List<String>> remotes() {
return remoteSources;
}
/**
- *
+ * Get mappring.
*/
public FragmentMapping mapping() {
return mapping;
diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/FragmentMapping.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/FragmentMapping.java
index ee1fd83..5fcbc05 100644
--- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/FragmentMapping.java
+++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/FragmentMapping.java
@@ -31,57 +31,54 @@ import org.apache.ignite.internal.processors.query.calcite.util.Commons;
import org.jetbrains.annotations.NotNull;
/**
- *
+ * FragmentMapping.
+ * TODO Documentation https://issues.apache.org/jira/browse/IGNITE-15859
*/
public class FragmentMapping implements Serializable {
- /**
... 23500 lines suppressed ...