diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/CalciteQueryProcessor.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/CalciteQueryProcessor.java index 2fafad476dcf7..674234eb9b0d8 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/CalciteQueryProcessor.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/CalciteQueryProcessor.java @@ -33,7 +33,6 @@ import org.apache.calcite.plan.ConventionTraitDef; import org.apache.calcite.plan.RelTraitDef; import org.apache.calcite.rel.RelCollationTraitDef; -import org.apache.calcite.rel.core.Correlate; import org.apache.calcite.schema.SchemaPlus; import org.apache.calcite.sql.SqlCall; import org.apache.calcite.sql.SqlDdl; @@ -145,8 +144,6 @@ public class CalciteQueryProcessor extends GridProcessorAdapter implements Query // See Apache Calcite ticket for more information, assertion is incorrect. // FRAMEWORK_CONFIG initialize SqlToRelConverter class. Assertions should be disabled before class initialization. SqlToRelConverter.class.getClassLoader().setClassAssertionStatus(SqlToRelConverter.class.getName(), false); - // TODO Workaround for https://issues.apache.org/jira/browse/CALCITE-5421 and https://issues.apache.org/jira/browse/CALCITE-7034 - Correlate.class.getClassLoader().setClassAssertionStatus(Correlate.class.getName(), false); } /** diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/IgniteMdColumnOrigins.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/IgniteMdColumnOrigins.java index 3606dc38a1e94..8a1331578b812 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/IgniteMdColumnOrigins.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/IgniteMdColumnOrigins.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.Set; import org.apache.calcite.plan.RelOptTable; +import org.apache.calcite.plan.volcano.RelSubset; import org.apache.calcite.rel.RelNode; import org.apache.calcite.rel.core.Aggregate; import org.apache.calcite.rel.core.AggregateCall; @@ -33,9 +34,11 @@ import org.apache.calcite.rel.core.Project; import org.apache.calcite.rel.core.SetOp; import org.apache.calcite.rel.core.Sort; +import org.apache.calcite.rel.core.Spool; import org.apache.calcite.rel.core.TableFunctionScan; import org.apache.calcite.rel.core.TableModify; import org.apache.calcite.rel.metadata.BuiltInMetadata; +import org.apache.calcite.rel.metadata.CyclicMetadataException; import org.apache.calcite.rel.metadata.MetadataDef; import org.apache.calcite.rel.metadata.MetadataHandler; import org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider; @@ -51,8 +54,11 @@ import org.apache.calcite.rex.RexSlot; import org.apache.calcite.rex.RexVisitor; import org.apache.calcite.rex.RexVisitorImpl; -import org.apache.calcite.util.BuiltInMethod; +import org.apache.calcite.util.ImmutableBitSet; +import org.apache.calcite.util.mapping.Mappings; +import org.apache.ignite.internal.processors.query.calcite.rel.IgniteLimit; import org.apache.ignite.internal.processors.query.calcite.rel.ProjectableFilterableTableScan; +import org.apache.ignite.internal.processors.query.calcite.util.Commons; import org.jetbrains.annotations.Nullable; /** @@ -61,8 +67,9 @@ */ public class IgniteMdColumnOrigins implements MetadataHandler { /** */ - public static final RelMetadataProvider SOURCE = ReflectiveRelMetadataProvider.reflectiveSource( - BuiltInMethod.COLUMN_ORIGIN.method, new IgniteMdColumnOrigins()); + public static final RelMetadataProvider SOURCE = + ReflectiveRelMetadataProvider.reflectiveSource( + new IgniteMdColumnOrigins(), BuiltInMetadata.ColumnOrigin.Handler.class); /** {@inheritDoc} */ @Override public MetadataDef getDef() { @@ -261,10 +268,10 @@ public class IgniteMdColumnOrigins implements MetadataHandler sources = new HashSet<>(); - getOperands(proj, RexSlot.class, sources); + getOperands(node, RexSlot.class, sources); boolean derived = sources.size() > 1; Set res = new HashSet<>(); @@ -281,7 +288,19 @@ public class IgniteMdColumnOrigins implements MetadataHandler void getOperands(RexNode rn, Class cls, Set res) { } } + /** + * Provides column origins for a subset. + * + *

Origins are resolved through the original (logical) expression of the set rather than through the current best + * plan: the best expression changes during optimization, and metadata depending on it makes row count estimates + * of the same expression unstable, which in turn leads to inconsistent costs and cyclic best plans in Volcano memo. + * Column origins are a property of the logical expression, so the original expression is a stable source of them. + */ + public @Nullable Set getColumnOrigins(RelSubset rel, + RelMetadataQuery mq, int outputColumn) { + RelNode original = rel.getOriginal(); + + try { + return mq.getColumnOrigins(original != null ? original : + rel.stripped(), outputColumn); + } + catch (CyclicMetadataException ignore) { + // Cyclic set (see CALCITE-1048): origins are unknown, callers fall back to generic estimations. + return null; + } + } + + /** Spools pass rows of their input through, so column origins are the same as the origins of the input. */ + public @Nullable Set getColumnOrigins(Spool rel, RelMetadataQuery mq, int iOutputColumn) { + return mq.getColumnOrigins(rel.getInput(), iOutputColumn); + } + + /** Limit passes rows of its input through, so column origins are the same as the origins of the input. */ + public @Nullable Set getColumnOrigins(IgniteLimit rel, RelMetadataQuery mq, int iOutputColumn) { + return mq.getColumnOrigins(rel.getInput(), iOutputColumn); + } + /** * Catch-all rule when none of the others apply. * @@ -369,15 +420,15 @@ private static Set getMultipleColumns(RexNode rexNode, RelNode final Set set = new HashSet<>(); final RexVisitor visitor = new RexVisitorImpl(true) { - @Override public Void visitInputRef(RexInputRef inputRef) { - Set inputSet = mq.getColumnOrigins(input, inputRef.getIndex()); + @Override public Void visitInputRef(RexInputRef inputRef) { + Set inputSet = mq.getColumnOrigins(input, inputRef.getIndex()); - if (inputSet != null) - set.addAll(inputSet); + if (inputSet != null) + set.addAll(inputSet); - return null; - } - }; + return null; + } + }; rexNode.accept(visitor); diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/IgniteMdPercentageOriginalRows.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/IgniteMdPercentageOriginalRows.java index 4c4a24d871a08..baa5ae6539977 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/IgniteMdPercentageOriginalRows.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/IgniteMdPercentageOriginalRows.java @@ -17,17 +17,20 @@ package org.apache.ignite.internal.processors.query.calcite.metadata; +import org.apache.calcite.plan.volcano.RelSubset; import org.apache.calcite.rel.RelNode; import org.apache.calcite.rel.core.Aggregate; import org.apache.calcite.rel.core.Join; import org.apache.calcite.rel.core.Union; import org.apache.calcite.rel.metadata.BuiltInMetadata; +import org.apache.calcite.rel.metadata.CyclicMetadataException; import org.apache.calcite.rel.metadata.MetadataDef; import org.apache.calcite.rel.metadata.MetadataHandler; import org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider; import org.apache.calcite.rel.metadata.RelMetadataProvider; import org.apache.calcite.rel.metadata.RelMetadataQuery; import org.apache.calcite.util.BuiltInMethod; +import org.apache.ignite.internal.processors.query.calcite.rel.ProjectableFilterableTableScan; /** * See {@link org.apache.calcite.rel.metadata.RelMdPercentageOriginalRows} @@ -105,6 +108,31 @@ public Double getPercentageOriginalRows(Join rel, RelMetadataQuery mq) { return left * right; } + /** + * Percentage for a subset. + * + *

Resolved through the original (logical) expression of the set rather than through the current best plan, + * consistently with row count, selectivity and column origins: the best expression changes during optimization + * and metadata depending on it makes estimates unstable. Without this handler a subset is treated as a leaf and + * filters pushed down to the join inputs are never accounted. + */ + public Double getPercentageOriginalRows(RelSubset rel, RelMetadataQuery mq) { + RelNode original = rel.getOriginal(); + + try { + return mq.getPercentageOriginalRows(original != null ? original : rel.stripped()); + } + catch (CyclicMetadataException ignore) { + // Cyclic set (see CALCITE-1048): no information. + return null; + } + } + + /** A scan with a pushed down condition filters rows by the selectivity of this condition. */ + public Double getPercentageOriginalRows(ProjectableFilterableTableScan rel, RelMetadataQuery mq) { + return rel.condition() == null ? 1.0 : mq.getSelectivity(rel, null); + } + /** */ public Double getPercentageOriginalRows(RelNode rel, RelMetadataQuery mq) { if (rel.getInputs().size() > 1) { diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/IgniteMdRowCount.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/IgniteMdRowCount.java index 756e4b4e0c6f5..46df89ba1419b 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/IgniteMdRowCount.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/IgniteMdRowCount.java @@ -17,26 +17,37 @@ package org.apache.ignite.internal.processors.query.calcite.metadata; +import java.util.BitSet; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import org.apache.calcite.plan.RelOptTable; +import org.apache.calcite.rel.RelNode; import org.apache.calcite.rel.core.Intersect; import org.apache.calcite.rel.core.Join; import org.apache.calcite.rel.core.JoinInfo; import org.apache.calcite.rel.core.JoinRelType; import org.apache.calcite.rel.core.Minus; import org.apache.calcite.rel.core.Sort; +import org.apache.calcite.rel.metadata.BuiltInMetadata; import org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider; +import org.apache.calcite.rel.metadata.RelColumnOrigin; import org.apache.calcite.rel.metadata.RelMdRowCount; import org.apache.calcite.rel.metadata.RelMdUtil; import org.apache.calcite.rel.metadata.RelMetadataProvider; import org.apache.calcite.rel.metadata.RelMetadataQuery; import org.apache.calcite.rex.RexNode; -import org.apache.calcite.util.BuiltInMethod; import org.apache.calcite.util.ImmutableBitSet; import org.apache.calcite.util.ImmutableIntList; import org.apache.calcite.util.Util; +import org.apache.calcite.util.mapping.IntPair; import org.apache.ignite.internal.processors.query.calcite.rel.IgniteAggregate; +import org.apache.ignite.internal.processors.query.calcite.rel.IgniteCorrelatedNestedLoopJoin; import org.apache.ignite.internal.processors.query.calcite.rel.IgniteLimit; import org.apache.ignite.internal.processors.query.calcite.rel.IgniteSortedIndexSpool; import org.apache.ignite.internal.processors.query.calcite.rel.IgniteTableModify; +import org.apache.ignite.internal.processors.query.calcite.schema.IgniteTable; +import org.apache.ignite.internal.util.GridLeanMap; import org.apache.ignite.internal.util.typedef.F; import org.jetbrains.annotations.Nullable; @@ -45,14 +56,24 @@ /** */ @SuppressWarnings("unused") // actually all methods are used by runtime generated classes public class IgniteMdRowCount extends RelMdRowCount { + /** */ + private static final double NON_EQUI_COEFF = 0.7; + + /** */ + public static final double EQUI_COEFF = 0.8; + /** */ public static final RelMetadataProvider SOURCE = - ReflectiveRelMetadataProvider.reflectiveSource( - BuiltInMethod.ROW_COUNT.method, new IgniteMdRowCount()); + ReflectiveRelMetadataProvider.reflectiveSource(new IgniteMdRowCount(), BuiltInMetadata.RowCount.Handler.class); + + /** */ + public Double getRowCount(IgniteCorrelatedNestedLoopJoin rel, RelMetadataQuery mq) { + return rel.estimateRowCount(mq); + } /** {@inheritDoc} */ @Override public Double getRowCount(Join rel, RelMetadataQuery mq) { - return rel.estimateRowCount(mq); + return joinRowCount(mq, rel); } /** {@inheritDoc} */ @@ -62,6 +83,29 @@ public class IgniteMdRowCount extends RelMdRowCount { /** */ @Nullable public static Double joinRowCount(RelMetadataQuery mq, Join rel) { + return joinRowCount(mq, rel, 1.0); + } + + /** + * Estimates row count of a correlated nested loop join. + * + *

The join condition of such a join is pushed to its right input as a correlated filter, so the right input + * is already reduced by the condition selectivity. To get the same estimate as for the equivalent uncorrelated + * join, the row count and the percentage of original rows of the right input are restored before estimation. + */ + @Nullable public static Double correlatedJoinRowCount(RelMetadataQuery mq, Join rel) { + Double selectivity = mq.getSelectivity(rel, rel.getCondition()); + + double rightAdjust = selectivity == null || selectivity <= 0.0 ? 1.0 : 1.0 / selectivity; + + return joinRowCount(mq, rel, rightAdjust); + } + + /** + * @param rightAdjust Multiplier restoring estimates of the right input when the join condition has already been + * applied to it (see {@link #correlatedJoinRowCount(RelMetadataQuery, Join)}), {@code 1.0} otherwise. + */ + @Nullable private static Double joinRowCount(RelMetadataQuery mq, Join rel, double rightAdjust) { if (!rel.getJoinType().projectsRight()) { // Create a RexNode representing the selectivity of the // semijoin filter and pass it to getSelectivity @@ -72,48 +116,272 @@ public class IgniteMdRowCount extends RelMdRowCount { mq.getRowCount(rel.getLeft())); } + JoinInfo joinInfo = rel.analyzeCondition(); + + if (joinInfo.pairs().isEmpty()) { + // Fall-back to calcite's implementation. + return RelMdUtil.getJoinRowCount(mq, rel, rel.getCondition()); + } + // Row count estimates of 0 will be rounded up to 1. // So, use maxRowCount where the product is very small. - final Double left = mq.getRowCount(rel.getLeft()); - final Double right = mq.getRowCount(rel.getRight()); + final Double leftRowCnt = mq.getRowCount(rel.getLeft()); + final Double rightRowCnt = multiply(mq.getRowCount(rel.getRight()), rightAdjust); - if (left == null || right == null) + if (leftRowCnt == null || rightRowCnt == null) return null; - if (left <= 1D || right <= 1D) { + if (leftRowCnt <= 1D || rightRowCnt <= 1D) { Double max = mq.getMaxRowCount(rel); if (max != null && max <= 1D) return max; } - JoinInfo joinInfo = rel.analyzeCondition(); + Map columnsFromLeft = resolveOrigins(mq, rel.getLeft(), joinInfo.leftKeys); + Map columnsFromRight = resolveOrigins(mq, rel.getRight(), joinInfo.rightKeys); + + if (columnsFromLeft.isEmpty() || columnsFromRight.isEmpty()) { + // Use crude estimation instead. + return crudeEstimation(mq, joinInfo, rel, leftRowCnt, rightRowCnt); + } + + Map joinCtxts = new HashMap<>(); + for (IntPair joinKeys : joinInfo.pairs()) { + KeyColumnOrigin leftKey = columnsFromLeft.get(joinKeys.source); + KeyColumnOrigin rightKey = columnsFromRight.get(joinKeys.target); + if (leftKey == null || rightKey == null) { + continue; + } + + joinCtxts.computeIfAbsent( + new TablesPair( + leftKey.origin.getOriginTable(), + rightKey.origin.getOriginTable() + ), + key -> { + IgniteTable leftTable = key.left.unwrap(IgniteTable.class); + IgniteTable rightTable = key.right.unwrap(IgniteTable.class); + + assert leftTable != null && rightTable != null; + + int leftPkSize = leftTable.distribution().getKeys().size(); + int rightPkSize = rightTable.distribution().getKeys().size(); + + return new JoinContext(leftPkSize, rightPkSize); + } + ).countKeys(leftKey, rightKey); + } + + if (joinCtxts.isEmpty()) { + // Fall-back to calcite's implementation. + return RelMdUtil.getJoinRowCount(mq, rel, rel.getCondition()); + } + + Iterator it = joinCtxts.values().iterator(); + JoinContext joinCtx = it.next(); + while (it.hasNext()) { + JoinContext nextCtx = it.next(); + if (nextCtx.joinType().strength > joinCtx.joinType().strength) { + joinCtx = nextCtx; + } + + if (joinCtx.joinType().strength == JoiningRelationType.PK_ON_PK.strength) { + break; + } + } + + if (joinCtx.joinType() == JoiningRelationType.UNKNOWN) { + // Use crude estimation instead. + return crudeEstimation(mq, joinInfo, rel, leftRowCnt, rightRowCnt); + } + + double postFiltrationAdjustment = 1.0; + + switch (rel.getJoinType()) { + case INNER: + case SEMI: + // Extra join keys as well as non-equi conditions serves as post-filtration, + // therefore we need to adjust final result with a little factor. + if (joinCtxts.size() != 1 || !joinInfo.isEqui()) + postFiltrationAdjustment = NON_EQUI_COEFF; + + break; + default: + break; + } + + double baseRowCnt = 0.0; + Double percentageAdjustment = null; + if (joinCtx.joinType() == JoiningRelationType.PK_ON_PK) { + postFiltrationAdjustment = 1.0; + + if (rel.getJoinType() == JoinRelType.INNER || rel.getJoinType() == JoinRelType.SEMI) { + postFiltrationAdjustment = EQUI_COEFF; + // Assume we have two fact tables SALES and RETURNS sharing the same primary key. Every item + // can be sold, but only items which were sold can be returned back, therefore + // size(SALES) > size(RETURNS). When joining SALES on RETURNS by primary key, the estimated + // result size will be the same as the size of the smallest table (RETURNS in this case), + // adjusted by the percentage of rows of the biggest table (SALES in this case; percentage + // adjustment is required to account for predicates pushed down to the table, e.g. we are + // interested in returns of items with certain category) + if (leftRowCnt > rightRowCnt) { + baseRowCnt = rightRowCnt; + percentageAdjustment = mq.getPercentageOriginalRows(rel.getLeft()); + } + else { + baseRowCnt = leftRowCnt; + percentageAdjustment = rightPercentage(mq, rel, rightAdjust); + } + } + else if (rel.getJoinType() == JoinRelType.LEFT) { + baseRowCnt = leftRowCnt; + } + else if (rel.getJoinType() == JoinRelType.RIGHT) { + baseRowCnt = rightRowCnt; + } + else if (rel.getJoinType() == JoinRelType.FULL) { + Double selectivity = mq.getSelectivity(rel, rel.getCondition()); + + // Fall-back. + if (selectivity == null) { + // Fall-back to calcite's implementation. + return RelMdUtil.getJoinRowCount(mq, rel, rel.getCondition()); + } + + baseRowCnt = rightRowCnt + leftRowCnt; + percentageAdjustment = 1.0 - selectivity; + } + } + else if (joinCtx.joinType() == JoiningRelationType.FK_ON_PK) { + // For foreign key joins the base table is the one which is joined by non-primary key columns. + if (rel.getJoinType() == JoinRelType.INNER || rel.getJoinType() == JoinRelType.SEMI) { + Double selectivity = mq.getSelectivity(rel, rel.getCondition()); + baseRowCnt = leftRowCnt * selectivity; + percentageAdjustment = rightPercentage(mq, rel, rightAdjust); + } + else if (rel.getJoinType() == JoinRelType.LEFT || rel.getJoinType() == JoinRelType.RIGHT) { + baseRowCnt = leftRowCnt; + } + else if (rel.getJoinType() == JoinRelType.FULL) { + Double selectivity = mq.getSelectivity(rel, rel.getCondition()); + + // Fall-back. + if (selectivity == null) { + // Fall-back to calcite's implementation. + return RelMdUtil.getJoinRowCount(mq, rel, rel.getCondition()); + } + + baseRowCnt = rightRowCnt + leftRowCnt; + percentageAdjustment = 1.0 - selectivity; + } + } + else { // PK_ON_FK + if (rel.getJoinType() == JoinRelType.INNER || rel.getJoinType() == JoinRelType.SEMI) { + Double selectivity = mq.getSelectivity(rel, rel.getCondition()); + baseRowCnt = rightRowCnt * selectivity;; + percentageAdjustment = mq.getPercentageOriginalRows(rel.getLeft()); + } + else if (rel.getJoinType() == JoinRelType.RIGHT || rel.getJoinType() == JoinRelType.LEFT) { + baseRowCnt = rightRowCnt; + } + else if (rel.getJoinType() == JoinRelType.FULL) { + Double selectivity = mq.getSelectivity(rel, rel.getCondition()); + + // Fall-back. + if (selectivity == null) { + // Fall-back to calcite's implementation. + return RelMdUtil.getJoinRowCount(mq, rel, rel.getCondition()); + } + + baseRowCnt = rightRowCnt + leftRowCnt; + percentageAdjustment = 1.0 - selectivity; + } + } + + if (percentageAdjustment == null) { + // No info, let's be conservative. + percentageAdjustment = 1.0; + } + + return baseRowCnt * percentageAdjustment * postFiltrationAdjustment; + } + + /** Percentage of original rows of the right input, see {@link #joinRowCount(RelMetadataQuery, Join, double)}. */ + @Nullable private static Double rightPercentage(RelMetadataQuery mq, Join rel, double rightAdjust) { + Double percentage = mq.getPercentageOriginalRows(rel.getRight()); + + return percentage == null ? null : Math.min(1.0, percentage * rightAdjust); + } + + /** */ + private static Map resolveOrigins(RelMetadataQuery mq, RelNode joinShoulder, ImmutableIntList keys) { + GridLeanMap origins = new GridLeanMap<>(); + + for (int i : keys) { + if (origins.containsKey(i)) { + continue; + } + + RelColumnOrigin origin = mq.getColumnOrigin(joinShoulder, i); + if (origin == null) { + continue; + } + + IgniteTable table = origin.getOriginTable().unwrap(IgniteTable.class); + if (table == null || !table.distribution().function().affinity()) + continue; + + // Keys can relate to affinity not pk, just assumption here. + ImmutableIntList distKeys = table.distribution().getKeys(); + + int idx = distKeys.indexOf(origin.getOriginColumnOrdinal()); + + origins.put(i, new KeyColumnOrigin(origin, idx)); + } + + return origins; + } + + /** + * @param origin + * @param positionInKey + */ + private record KeyColumnOrigin(RelColumnOrigin origin, int positionInKey) { } + + /** This part of estimation is applicable for distributions different from hash, i.e. broadcast, single. */ + private static Double crudeEstimation(RelMetadataQuery mq, JoinInfo joinInfo, Join rel, Double leftRowCnt, Double rightRowCnt) { ImmutableIntList leftKeys = joinInfo.leftKeys; ImmutableIntList rightKeys = joinInfo.rightKeys; - double selectivity = mq.getSelectivity(rel, rel.getCondition()); + Double selectivity = mq.getSelectivity(rel, rel.getCondition()); + + if (selectivity == null) { + // Fall-back to calcite's implementation. + return RelMdUtil.getJoinRowCount(mq, rel, rel.getCondition()); + } if (F.isEmpty(leftKeys) || F.isEmpty(rightKeys)) - return left * right * selectivity; + return leftRowCnt * rightRowCnt * selectivity; double leftDistinct = Util.first( - mq.getDistinctRowCount(rel.getLeft(), ImmutableBitSet.of(leftKeys), null), left); + mq.getDistinctRowCount(rel.getLeft(), ImmutableBitSet.of(leftKeys), null), leftRowCnt); double rightDistinct = Util.first( - mq.getDistinctRowCount(rel.getRight(), ImmutableBitSet.of(rightKeys), null), right); + mq.getDistinctRowCount(rel.getRight(), ImmutableBitSet.of(rightKeys), null), rightRowCnt); - double leftCardinality = leftDistinct / left; - double rightCardinality = rightDistinct / right; + double leftCardinality = leftDistinct / leftRowCnt; + double rightCardinality = rightDistinct / rightRowCnt; - double rowsCnt = (Math.min(left, right) / (leftCardinality * rightCardinality)) * selectivity; + double rowsCnt = (Math.min(leftRowCnt, rightRowCnt) / (leftCardinality * rightCardinality)) * selectivity; JoinRelType type = rel.getJoinType(); if (type == JoinRelType.LEFT) - rowsCnt += left; + rowsCnt += leftRowCnt; else if (type == JoinRelType.RIGHT) - rowsCnt += right; + rowsCnt += rightRowCnt; else if (type == JoinRelType.FULL) - rowsCnt += left + right; + rowsCnt += leftRowCnt + rightRowCnt; return rowsCnt; } @@ -157,4 +425,120 @@ public double getRowCount(IgniteLimit rel, RelMetadataQuery mq) { public double getRowCount(IgniteTableModify rel, RelMetadataQuery mq) { return rel.estimateRowCount(mq); } + + /** */ + private record TablesPair(RelOptTable left, RelOptTable right) { } + + /** */ + private static class JoinContext { + /** Used columns of primary key of table from left side. */ + private final BitSet leftKeys; + + /** Used columns of primary key of table from right side. */ + private final BitSet rightKeys; + + /** + * Used columns of primary key in both tables. + * + *

This bitset is initialized when PK of both tables has equal columns count, and + * bits are cleared when join pair contains columns with equal positions in PK of corresponding + * table. For example, having tables T1 and T2 with primary keys in both tables defined as + * CONSTRAINT PRIMARY KEY (a, b), in case of query + * {@code SELECT ... FROM t1 JOIN t2 ON t1.a = t2.a AND t1.b = t2.b} commonKeys will be initialized + * and cleared, but in case of query {@code SELECT ... FROM t1 JOIN t2 ON t1.a = t2.b AND t1.b = t2.a} + * (mind the join condition, where column A of one table compared with column B of another), will be + * only initialized (since size of the primary keys are equal), but not cleared. + */ + private final @Nullable BitSet commonKeys; + + /** */ + JoinContext(int leftPkSize, int rightPkSize) { + leftKeys = new BitSet(); + rightKeys = new BitSet(); + commonKeys = leftPkSize == rightPkSize && leftPkSize != 0 ? new BitSet() : null; + + leftKeys.set(0, leftPkSize); + rightKeys.set(0, rightPkSize); + + if (commonKeys != null) { + assert leftPkSize == rightPkSize; + + commonKeys.set(0, leftPkSize); + } + } + + /** */ + void countKeys(KeyColumnOrigin left, KeyColumnOrigin right) { + if (left.positionInKey >= 0) { + leftKeys.clear(left.positionInKey); + } + + if (right.positionInKey >= 0) { + rightKeys.clear(right.positionInKey); + } + + if (commonKeys != null && left.positionInKey == right.positionInKey && left.positionInKey >= 0) { + commonKeys.clear(left.positionInKey); + } + } + + /** */ + JoiningRelationType joinType() { + if (commonKeys != null && commonKeys.isEmpty()) { + return JoiningRelationType.PK_ON_PK; + } + + if (rightKeys.isEmpty()) { + return JoiningRelationType.FK_ON_PK; + } + + if (leftKeys.isEmpty()) { + return JoiningRelationType.PK_ON_FK; + } + + return JoiningRelationType.UNKNOWN; + } + } + + /** Enumeration of join types by their semantic. */ + private enum JoiningRelationType { + /** + * Join by non-primary key columns. + * + *

Semantic is unknown. + */ + UNKNOWN(0), + + /** + * Join by primary keys on non-primary keys. + * + *

Currently we don't support Foreign Keys, thus we will assume such types of joins + * as joins by foreign key. + */ + PK_ON_FK(UNKNOWN.strength + 1), + + /** + * Join by non-primary keys on primary keys. + * + *

Currently we don't support Foreign Keys, thus we will assume such types of joins + * as joins by foreign key. + */ + FK_ON_PK(PK_ON_FK.strength + 1), + + /** + * Join of two tables which sharing the same primary key. + * + *

For example, join of tables CATALOG_SALES and CATALOG_RETURN from TPC-DS suite: both tables + * have the same primary key (ITEM_ID, ORDER_ID). + */ + PK_ON_PK(FK_ON_PK.strength + 1); + + /** The higher, the better. */ + private final int strength; + + /** */ + JoiningRelationType(int strength) { + this.strength = strength; + } + } } diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/IgniteMdSelectivity.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/IgniteMdSelectivity.java index 3c1c09211dc58..8148d137ae05e 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/IgniteMdSelectivity.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/metadata/IgniteMdSelectivity.java @@ -25,6 +25,8 @@ import org.apache.calcite.plan.RelOptUtil; import org.apache.calcite.plan.volcano.RelSubset; import org.apache.calcite.rel.RelNode; +import org.apache.calcite.rel.metadata.BuiltInMetadata; +import org.apache.calcite.rel.metadata.CyclicMetadataException; import org.apache.calcite.rel.metadata.ReflectiveRelMetadataProvider; import org.apache.calcite.rel.metadata.RelColumnOrigin; import org.apache.calcite.rel.metadata.RelMdSelectivity; @@ -44,7 +46,6 @@ import org.apache.calcite.sql.SqlOperator; import org.apache.calcite.sql.type.BasicSqlType; import org.apache.calcite.sql.type.SqlTypeFamily; -import org.apache.calcite.util.BuiltInMethod; import org.apache.calcite.util.DateString; import org.apache.calcite.util.TimeString; import org.apache.calcite.util.TimestampString; @@ -67,13 +68,13 @@ public class IgniteMdSelectivity extends RelMdSelectivity { private static final double IS_NULL_SELECTIVITY = 0.1; /** Default selectivity for IS NOT NULL conditions. */ - private static final double IS_NOT_NULL_SELECTIVITY = 1 - IS_NULL_SELECTIVITY; + public static final double IS_NOT_NULL_SELECTIVITY = 1 - IS_NULL_SELECTIVITY; /** Default selectivity for equals conditions. */ - private static final double EQUALS_SELECTIVITY = 0.15; + public static final double EQUALS_SELECTIVITY = 0.15; /** Default selectivity for comparison conitions. */ - private static final double COMPARISON_SELECTIVITY = 0.5; + public static final double COMPARISON_SELECTIVITY = 0.5; /** Default selectivity for other conditions. */ private static final double OTHER_SELECTIVITY = 0.25; @@ -81,12 +82,11 @@ public class IgniteMdSelectivity extends RelMdSelectivity { /** * Math context to use in estimations calculations. */ - private final MathContext MATH_CONTEXT = MathContext.DECIMAL64; + private static final MathContext MATH_CONTEXT = MathContext.DECIMAL64; /** */ public static final RelMetadataProvider SOURCE = - ReflectiveRelMetadataProvider.reflectiveSource( - BuiltInMethod.SELECTIVITY.method, new IgniteMdSelectivity()); + ReflectiveRelMetadataProvider.reflectiveSource(new IgniteMdSelectivity(), BuiltInMetadata.Selectivity.Handler.class); /** */ public Double getSelectivity(ProjectableFilterableTableScan rel, RelMetadataQuery mq, RexNode predicate) { @@ -116,14 +116,24 @@ public Double getSelectivity(IgniteSortedIndexSpool rel, RelMetadataQuery mq, Re return mq.getSelectivity(rel.getInput(), rel.condition()); } - /** */ + /** + * Selectivity for a subset. + * + *

Resolved through the original (logical) expression of the set rather than through the current best plan, + * because the best expression changes during optimization and metadata depending on it makes estimates of the same + * expression unstable (see {@link IgniteMdColumnOrigins#getColumnOrigins(RelSubset, RelMetadataQuery, int)}). + */ public Double getSelectivity(RelSubset rel, RelMetadataQuery mq, RexNode predicate) { - RelNode best = rel.getBest(); + RelNode original = rel.getOriginal(); - if (best == null) - return super.getSelectivity(rel, mq, predicate); - - return getSelectivity(best, mq, predicate); + try { + return mq.getSelectivity(original != null ? original : + rel.stripped(), predicate); + } + catch (CyclicMetadataException ignore) { + // Cyclic set (see CALCITE-1048): fall back to the predicate-only guess. + return RelMdUtil.guessSelectivity(predicate); + } } /** diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteCorrelatedNestedLoopJoin.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteCorrelatedNestedLoopJoin.java index e9a9380140c47..4759520ef3534 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteCorrelatedNestedLoopJoin.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteCorrelatedNestedLoopJoin.java @@ -39,6 +39,7 @@ import org.apache.calcite.rel.metadata.RelMetadataQuery; import org.apache.calcite.rex.RexNode; import org.apache.calcite.util.Pair; +import org.apache.calcite.util.Util; import org.apache.ignite.internal.processors.query.calcite.metadata.cost.IgniteCost; import org.apache.ignite.internal.processors.query.calcite.metadata.cost.IgniteCostFactory; import org.apache.ignite.internal.processors.query.calcite.trait.CorrelationTrait; @@ -50,6 +51,7 @@ import org.apache.ignite.internal.util.typedef.F; import org.apache.ignite.internal.util.typedef.internal.U; +import static org.apache.ignite.internal.processors.query.calcite.metadata.IgniteMdRowCount.correlatedJoinRowCount; import static org.apache.ignite.internal.processors.query.calcite.util.Commons.maxPrefix; /** @@ -201,20 +203,10 @@ public IgniteCorrelatedNestedLoopJoin(RelInput input) { @Override public RelOptCost computeSelfCost(RelOptPlanner planner, RelMetadataQuery mq) { IgniteCostFactory costFactory = (IgniteCostFactory)planner.getCostFactory(); - double leftCnt = mq.getRowCount(getLeft()); + double rowCnt = mq.getRowCount(this); - if (Double.isInfinite(leftCnt)) - return costFactory.makeInfiniteCost(); - - double rightCnt = mq.getRowCount(getRight()); - - if (Double.isInfinite(rightCnt)) - return costFactory.makeInfiniteCost(); - - double rows = leftCnt * rightCnt; - - return costFactory.makeCost(rows, - rows * (IgniteCost.ROW_COMPARISON_COST + IgniteCost.ROW_PASS_THROUGH_COST), 0); + return costFactory.makeCost(rowCnt, + rowCnt * (IgniteCost.ROW_COMPARISON_COST + IgniteCost.ROW_PASS_THROUGH_COST), 0); } /** {@inheritDoc} */ @@ -269,7 +261,7 @@ public IgniteCorrelatedNestedLoopJoin(RelInput input) { /** {@inheritDoc} */ @Override public double estimateRowCount(RelMetadataQuery mq) { - // condition selectivity already counted within the external filter - return super.estimateRowCount(mq) / mq.getSelectivity(this, getCondition()); + // The join condition is already applied by the correlated filter of the right input. + return Util.first(correlatedJoinRowCount(mq, this), 1D); } } diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteHashJoin.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteHashJoin.java index 0b0c58c09122f..cc86fcf894498 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteHashJoin.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteHashJoin.java @@ -78,8 +78,6 @@ public IgniteHashJoin(RelInput input) { if (Double.isInfinite(leftRowCnt) || Double.isInfinite(rightRowCnt)) return planner.getCostFactory().makeInfiniteCost(); - double rowCnt = leftRowCnt + rightRowCnt; - int rightKeysSize = joinInfo.rightKeys.size(); double rightSize = rightRowCnt * IgniteCost.AVERAGE_FIELD_SIZE * getRight().getRowType().getFieldCount(); @@ -89,6 +87,8 @@ public IgniteHashJoin(RelInput input) { rightSize += distRightRows * rightKeysSize * IgniteCost.AVERAGE_FIELD_SIZE; + Double rowCnt = mq.getRowCount(this); + return costFactory.makeCost(rowCnt, rowCnt * IgniteCost.HASH_LOOKUP_COST, 0, rightSize, 0); } diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteMergeJoin.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteMergeJoin.java index 15a813fd659e4..aea87e8f45d10 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteMergeJoin.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteMergeJoin.java @@ -259,10 +259,10 @@ else if (containsOrderless(rightKeys, collation)) { if (Double.isInfinite(rightCnt)) return costFactory.makeInfiniteCost(); - double rows = leftCnt + rightCnt; + double rowCnt = mq.getRowCount(this); - return costFactory.makeCost(rows, - rows * (IgniteCost.ROW_COMPARISON_COST + IgniteCost.ROW_PASS_THROUGH_COST), 0); + return costFactory.makeCost(rowCnt, + rowCnt * (IgniteCost.ROW_COMPARISON_COST + IgniteCost.ROW_PASS_THROUGH_COST), 0); } /** {@inheritDoc} */ diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteNestedLoopJoin.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteNestedLoopJoin.java index e140451eec815..bb7610a13cd3b 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteNestedLoopJoin.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteNestedLoopJoin.java @@ -88,12 +88,12 @@ public IgniteNestedLoopJoin(RelInput input) { if (Double.isInfinite(rightCnt)) return costFactory.makeInfiniteCost(); - double rows = leftCnt * rightCnt; - double rightSize = rightCnt * getRight().getRowType().getFieldCount() * IgniteCost.AVERAGE_FIELD_SIZE; - return costFactory.makeCost(rows, - rows * (IgniteCost.ROW_COMPARISON_COST + IgniteCost.ROW_PASS_THROUGH_COST), 0, rightSize, 0); + double rowCnt = mq.getRowCount(this); + + return costFactory.makeCost(rowCnt, + leftCnt * rightCnt * (IgniteCost.ROW_COMPARISON_COST + IgniteCost.ROW_PASS_THROUGH_COST), 0, rightSize, 0); } /** {@inheritDoc} */ diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteSort.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteSort.java index 7e18955bbc5b2..59146c1d4b696 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteSort.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/rel/IgniteSort.java @@ -167,7 +167,7 @@ public IgniteSort(RelInput input) { // Distributed sorting is more preferable than sorting on the single node. if (TraitUtils.distribution(traitSet).satisfies(IgniteDistributions.single())) - cost.plus(costFactory.makeTinyCost()); + cost = cost.plus(costFactory.makeTinyCost()); return cost; } diff --git a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/Commons.java b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/Commons.java index fc91eb4483286..539732df59300 100644 --- a/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/Commons.java +++ b/modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/util/Commons.java @@ -452,6 +452,22 @@ public static Mappings.TargetMapping inverseMapping(ImmutableBitSet bitSet, int return mapping; } + /** + * Creates mapping from given projection. + * + *

Projection is a bit set of columns to extract from original row. + * + * @param projection Desired projection. + * @param sourceSize Size of the source. + * @return Mapping for given projection. + */ + public static Mappings.TargetMapping projectedMapping(ImmutableBitSet projection, int sourceSize) { + Mapping mapping = Mappings.create(MappingType.INVERSE_SURJECTION, sourceSize, projection.cardinality()); + for (Ord ord : Ord.zip(projection)) + mapping.set(ord.e, ord.i); + return mapping; + } + /** * Checks if there is a such permutation of all {@code elems} that is prefix of * provided {@code seq}. diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/LitmusCheckIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/LitmusCheckIntegrationTest.java new file mode 100644 index 0000000000000..19a082da06cb2 --- /dev/null +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/LitmusCheckIntegrationTest.java @@ -0,0 +1,68 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.ignite.internal.processors.query.calcite.integration; + +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.core.LoggerContext; +import org.apache.logging.log4j.core.config.Configurator; +import org.junit.Test; + +import static org.apache.logging.log4j.Level.DEBUG; + +/** Calcite litmus related tests. */ +public class LitmusCheckIntegrationTest extends AbstractBasicIntegrationTest { + /** Logger whose {@link Level#DEBUG} severity enables additional Calcite litmus checks. */ + private static final String PLANNER_LOG_NAME = "org.apache.calcite.plan.RelOptPlanner"; + + /** Level of the planner logger before the test. */ + private Level prevLevel; + + /** {@inheritDoc} */ + @Override protected void beforeTestsStarted() throws Exception { + super.beforeTestsStarted(); + + prevLevel = LoggerContext.getContext(false).getConfiguration().getLoggerConfig(PLANNER_LOG_NAME).getLevel(); + + // Some calcite litmus related checks are enabled only with DEBUG severity logging. + Configurator.setLevel(PLANNER_LOG_NAME, DEBUG); + } + + /** {@inheritDoc} */ + @Override protected void afterTestsStopped() throws Exception { + // Restore the level, otherwise every test executed later in the same JVM plans with the litmus checks enabled. + Configurator.setLevel(PLANNER_LOG_NAME, prevLevel); + + super.afterTestsStopped(); + } + + /** {@inheritDoc} */ + @Override protected int nodeCount() { + return 1; + } + + /** Check no calcite litmus exception is raised. */ + @Test + public void testLitmusLowerCost() { + sql("create table t11 (c1 int, c2 int, c3 int)"); + sql("create table t22 (c1 int, c2 int, c3 int)"); + sql("create index t11_idx on t11 (c3, c2, c1)"); + sql("create index t22_idx on t22 (c3, c2, c1)"); + + assertQuery("SELECT distinct p.c1 FROM t11 cd left join " + + "t22 p ON p.c2 = cd.c2 WHERE cd.c2 = 1;").resultSize(0).check(); + } +} diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryBlockingTaskExecutorIntegrationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryBlockingTaskExecutorIntegrationTest.java index a20dca19fa5da..fdf99637eadf5 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryBlockingTaskExecutorIntegrationTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/integration/QueryBlockingTaskExecutorIntegrationTest.java @@ -64,8 +64,7 @@ public void testJoinRehash() throws Exception { assertQuery(sql) .withParams("region0") - .matches(QueryChecker.containsSubPlan("IgniteMergeJoin")) - .matches(QueryChecker.containsSubPlan("IgniteExchange(distribution=[affinity")) + .matches(QueryChecker.matches(".*IgniteMergeJoin.*IgniteExchange\\(distribution=\\[affinity.*")) .returns(9500L) // 50 * sum(0 .. 19) .check(); diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AggregatePlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AggregatePlannerTest.java index 9cd942a2229b6..247b4e1be8f00 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AggregatePlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/AggregatePlannerTest.java @@ -443,10 +443,6 @@ public void colocated() throws Exception { .and(hasDistribution(IgniteDistributions.affinity(0, null, "hash")))), algo.rulesToDisable); - // TODO: https://issues.apache.org/jira/browse/IGNITE-16334 Eventually planner skips optimal join plan. - if (algo == AggregateAlgorithm.HASH) - return; - sql = "SELECT dept.deptid, agg.cnt " + "FROM dept " + "JOIN (SELECT deptid, COUNT(*) AS cnt FROM emp GROUP BY deptid) AS agg ON dept.deptid = agg.deptid"; diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/CorrelatedSubqueryPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/CorrelatedSubqueryPlannerTest.java index 11c36e47e4722..6c585bcf81fd5 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/CorrelatedSubqueryPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/CorrelatedSubqueryPlannerTest.java @@ -123,7 +123,7 @@ public void testPaddedCorrelateInSecondFilterSubquery() throws Exception { .and(input(0, nodeOrAnyChild(isTableScan("T1")))) .and(input(1, nodeOrAnyChild(isTableScan("T3") .and(ts -> "=($t0, $cor0.REF1)".equals(ts.condition().toString()))))) - .and(input(1, nodeOrAnyChild(isTableScan("T2").and(ts -> ts.condition() == null)))) + .and(input(1, nodeOrAnyChild(isTableScan("T2")))) ) ); } diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/JoinRowCountEstimationTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/JoinRowCountEstimationTest.java new file mode 100644 index 0000000000000..8d6252bc6018b --- /dev/null +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/JoinRowCountEstimationTest.java @@ -0,0 +1,347 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.ignite.internal.processors.query.calcite.planner; + +import java.math.BigDecimal; +import java.util.function.Predicate; +import java.util.regex.Pattern; +import org.apache.calcite.plan.RelOptUtil; +import org.apache.calcite.rel.RelNode; +import org.apache.calcite.sql.SqlExplainFormat; +import org.apache.calcite.sql.SqlExplainLevel; +import org.apache.calcite.util.ImmutableIntList; +import org.apache.ignite.internal.processors.query.calcite.rel.IgniteCorrelatedNestedLoopJoin; +import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema; +import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions; +import org.apache.ignite.internal.util.typedef.internal.CU; +import org.hamcrest.BaseMatcher; +import org.hamcrest.CoreMatchers; +import org.hamcrest.Description; +import org.hamcrest.Matcher; +import org.junit.Test; + +import static org.apache.ignite.internal.processors.query.calcite.metadata.IgniteMdSelectivity.COMPARISON_SELECTIVITY; +import static org.apache.ignite.internal.processors.query.calcite.metadata.IgniteMdSelectivity.EQUALS_SELECTIVITY; +import static org.apache.ignite.internal.processors.query.calcite.metadata.IgniteMdSelectivity.IS_NOT_NULL_SELECTIVITY; + +/** + * Tests to check row count estimation for join relation. + */ +public class JoinRowCountEstimationTest extends AbstractPlannerTest { + /** */ + private static final int CATALOG_SALES_SIZE = 1_441_548; + + /** */ + private static final int CATALOG_RETURNS_SIZE = 144_067; + + /** */ + private static final int DATE_DIM_SIZE = 73_049; + + /** */ + private static final String SELECT = "SELECT /*+ DISABLE_RULE(" + + "'JoinCommuteRule', " + + "'MergeJoinConverter', " + + "'NestedLoopJoinConverter', " + + "'CorrelateToNestedLoopRule'" + + ") */ * "; + + /** */ + private IgniteSchema publicSchema; + + /** {@inheritDoc} */ + @Override public void setup() { + super.setup(); + + TestTable tbl1 = createTable( + "CATALOG_SALES", + CATALOG_SALES_SIZE, + IgniteDistributions.affinity(ImmutableIntList.of(1, 2), CU.cacheId("default"), 0), + "ID", Integer.class, + "CS_ITEM_SK", Integer.class, + "CS_ORDER_NUMBER", Integer.class, + "CS_PROMO_SK", Integer.class + ); + + TestTable tbl2 = createTable( + "CATALOG_RETURNS", + CATALOG_RETURNS_SIZE, + IgniteDistributions.affinity(ImmutableIntList.of(1, 2), CU.cacheId("default"), 0), + "ID", Integer.class, + "CR_ITEM_SK", Integer.class, + "CR_ORDER_NUMBER", Integer.class, + "CR_RETURNED_DATE_SK", Integer.class, + "CR_RETURN_QUANTITY", Integer.class + ); + + TestTable tbl3 = createTable( + "DATE_DIM", + DATE_DIM_SIZE, + IgniteDistributions.affinity(ImmutableIntList.of(0), CU.cacheId("default"), 0), + "D_DATE_SK", Integer.class, + "D_MOY", Integer.class + ); + + publicSchema = createSchema(tbl1, tbl2, tbl3); + } + + /** */ + @Test + public void joinSameTableSimpleAffMergeJoin() throws Exception { + assertPlan(SELECT + + " FROM catalog_sales" + + " ,catalog_returns" + + " WHERE cs_item_sk = cr_item_sk" + + " AND cs_order_number = cr_order_number", + publicSchema, + nodeRowCount("IgniteHashJoin", approximatelyEqual(CATALOG_RETURNS_SIZE))); + + assertPlan(SELECT + + " FROM catalog_sales" + + " ,catalog_returns" + + " WHERE cs_item_sk = cr_item_sk" + + " AND cs_order_number = cr_order_number" + + " AND cs_promo_sk IS NOT NULL", + publicSchema, + nodeRowCount("IgniteHashJoin", approximatelyEqual(CATALOG_RETURNS_SIZE * IS_NOT_NULL_SELECTIVITY))); + } + + /** */ + @Test + public void joinByPrimaryKeysLeft() throws Exception { + assertPlan(SELECT + + " FROM catalog_sales LEFT JOIN catalog_returns ON" + + " cs_item_sk = cr_item_sk AND cs_order_number = cr_order_number", + publicSchema, + nodeRowCount("IgniteHashJoin", approximatelyEqual(CATALOG_SALES_SIZE))); + + assertPlan(SELECT + + " FROM catalog_sales LEFT JOIN catalog_returns" + + " ON cs_item_sk = cr_item_sk" + + " AND cs_order_number = cr_order_number" + + " AND cs_promo_sk IS NOT NULL", + publicSchema, + nodeRowCount("IgniteHashJoin", approximatelyEqual(CATALOG_SALES_SIZE))); + + assertPlan(SELECT + + " FROM catalog_sales LEFT JOIN catalog_returns" + + " ON cs_item_sk = cr_item_sk" + + " AND cs_order_number = cr_order_number" + + " AND cr_order_number > 1", + publicSchema, + nodeRowCount("IgniteHashJoin", approximatelyEqual(CATALOG_SALES_SIZE))); + } + + /** */ + @Test + public void joinByPrimaryKeysRight() throws Exception { + assertPlan(SELECT + + " FROM catalog_returns RIGHT JOIN catalog_sales ON" + + " cs_item_sk = cr_item_sk AND cs_order_number = cr_order_number", + publicSchema, + nodeRowCount("IgniteHashJoin", approximatelyEqual(CATALOG_SALES_SIZE))); + + assertPlan(SELECT + + " FROM catalog_returns RIGHT JOIN catalog_sales" + + " ON cs_item_sk = cr_item_sk" + + " AND cs_order_number = cr_order_number" + + " AND cs_promo_sk IS NOT NULL", + publicSchema, + nodeRowCount("IgniteHashJoin", approximatelyEqual(CATALOG_SALES_SIZE))); + + assertPlan(SELECT + + " FROM catalog_returns RIGHT JOIN catalog_sales" + + " ON cs_item_sk = cr_item_sk" + + " AND cs_order_number = cr_order_number" + + " AND cr_order_number > 1", + publicSchema, + nodeRowCount("IgniteHashJoin", approximatelyEqual(CATALOG_SALES_SIZE))); + } + + /** */ + @Test + public void joinByPrimaryKeysFull() throws Exception { + assertPlan(SELECT + + " FROM catalog_returns FULL OUTER JOIN catalog_sales ON" + + " cs_item_sk = cr_item_sk AND cs_order_number = cr_order_number", + publicSchema, + nodeRowCount("IgniteHashJoin", approximatelyEqual((int)((CATALOG_SALES_SIZE + CATALOG_RETURNS_SIZE) + * (1.0 - (EQUALS_SELECTIVITY * EQUALS_SELECTIVITY)))))); + + assertPlan(SELECT + + " FROM catalog_returns FULL OUTER JOIN catalog_sales" + + " ON cs_item_sk = cr_item_sk" + + " AND cs_order_number = cr_order_number" + + " AND cs_promo_sk IS NOT NULL", + publicSchema, + nodeRowCount("IgniteHashJoin", approximatelyEqual((int)((CATALOG_SALES_SIZE + CATALOG_RETURNS_SIZE) + * (1.0 - (EQUALS_SELECTIVITY * EQUALS_SELECTIVITY * IS_NOT_NULL_SELECTIVITY)))))); + + assertPlan(SELECT + + " FROM catalog_returns FULL OUTER JOIN catalog_sales" + + " ON cs_item_sk = cr_item_sk" + + " AND cs_order_number = cr_order_number" + + " AND cr_order_number > 1", + publicSchema, + nodeRowCount("IgniteHashJoin", approximatelyEqual((int)((CATALOG_SALES_SIZE + CATALOG_RETURNS_SIZE) + * (1.0 - (EQUALS_SELECTIVITY * EQUALS_SELECTIVITY * COMPARISON_SELECTIVITY)))))); + } + + /** */ + @Test + public void joinByForeignKey() throws Exception { + assertPlan(SELECT + + " FROM catalog_returns" + + " ,date_dim" + + " WHERE cr_returned_date_sk = d_date_sk", + publicSchema, + nodeRowCount("IgniteHashJoin", approximatelyEqual(CATALOG_RETURNS_SIZE * EQUALS_SELECTIVITY))); + + assertPlan(SELECT + + " FROM date_dim" + + " ,catalog_returns" + + " WHERE cr_returned_date_sk = d_date_sk" + + " AND d_moy > 6", + publicSchema, + nodeRowCount("IgniteHashJoin", + approximatelyEqual(CATALOG_RETURNS_SIZE * EQUALS_SELECTIVITY * COMPARISON_SELECTIVITY))); + } + + /** */ + @Test + public void joinByForeignKeyLeft() throws Exception { + assertPlan(SELECT + + " FROM catalog_returns LEFT JOIN date_dim ON" + + " cr_returned_date_sk = d_date_sk", + publicSchema, + nodeRowCount("IgniteHashJoin", CoreMatchers.is(CATALOG_RETURNS_SIZE))); + + assertPlan(SELECT + + " FROM date_dim LEFT JOIN catalog_returns ON" + + " cr_returned_date_sk = d_date_sk", + publicSchema, + nodeRowCount("IgniteHashJoin", CoreMatchers.is(CATALOG_RETURNS_SIZE))); + + assertPlan(SELECT + + " FROM catalog_returns LEFT JOIN date_dim ON" + + " cr_returned_date_sk = d_date_sk" + + " AND cr_return_quantity > 6", + publicSchema, + nodeRowCount("IgniteHashJoin", CoreMatchers.is(CATALOG_RETURNS_SIZE))); + } + + /** */ + @Test + public void joinByForeignKeyRight() throws Exception { + assertPlan(SELECT + + " FROM catalog_returns RIGHT JOIN date_dim ON" + + " cr_returned_date_sk = d_date_sk", + publicSchema, + nodeRowCount("IgniteHashJoin", CoreMatchers.is(CATALOG_RETURNS_SIZE))); + + assertPlan(SELECT + + " FROM date_dim RIGHT JOIN catalog_returns ON" + + " cr_returned_date_sk = d_date_sk", + publicSchema, + nodeRowCount("IgniteHashJoin", CoreMatchers.is(CATALOG_RETURNS_SIZE))); + + assertPlan(SELECT + + " FROM date_dim RIGHT JOIN catalog_returns ON" + + " cr_returned_date_sk = d_date_sk" + + " AND cr_return_quantity > 6", + publicSchema, + nodeRowCount("IgniteHashJoin", CoreMatchers.is(CATALOG_RETURNS_SIZE))); + } + + /** */ + @Test + public void joinByForeignKeyFull() throws Exception { + assertPlan(SELECT + + " FROM date_dim FULL OUTER JOIN catalog_returns ON" + + " cr_returned_date_sk = d_date_sk", + publicSchema, + nodeRowCount("IgniteHashJoin", approximatelyEqual((int)((DATE_DIM_SIZE + CATALOG_RETURNS_SIZE) + * (1.0 - (EQUALS_SELECTIVITY)))))); + + assertPlan(SELECT + + " FROM date_dim FULL OUTER JOIN catalog_returns ON" + + " cr_returned_date_sk = d_date_sk" + + " AND cr_return_quantity > 6", + publicSchema, + nodeRowCount("IgniteHashJoin", approximatelyEqual((int)((DATE_DIM_SIZE + CATALOG_RETURNS_SIZE) + * (1.0 - (EQUALS_SELECTIVITY * COMPARISON_SELECTIVITY)))))); + } + + /** */ + @Test + public void correlatedNestedLoopJoinRowCount() throws Exception { + assertPlan( + "SELECT /*+ CNL_JOIN */ * FROM catalog_returns" + + " ,date_dim" + + " WHERE cr_returned_date_sk = d_date_sk", + publicSchema, + nodeOrAnyChild(isInstanceOf(IgniteCorrelatedNestedLoopJoin.class) + .and(nodeRowCount("IgniteCorrelatedNestedLoopJoin", + approximatelyEqual(CATALOG_RETURNS_SIZE * EQUALS_SELECTIVITY))))); + } + + /** + * Matcher which ensures that node matching the pattern has row count matching provided matcher. + * + * @param nodePattern A pattern describing a node of interest. + * @param rowCountMatcher Matcher for the estimated row count. + * @return Matcher. + */ + static Predicate nodeRowCount(String nodePattern, Matcher rowCountMatcher) { + Pattern pattern = Pattern.compile(".*" + nodePattern + + "\\(.*?rowcount = (?\\d+).*"); + + return node -> { + String plan = RelOptUtil.dumpPlan("", node, SqlExplainFormat.TEXT, SqlExplainLevel.ALL_ATTRIBUTES); + + String sanitized = plan.replaceAll("\\R", ""); + java.util.regex.Matcher matcher = pattern.matcher(sanitized); + + if (!matcher.matches()) + return false; + + String rowCntStr = matcher.group("rowcount"); + + return rowCountMatcher.matches(new BigDecimal(rowCntStr).intValue()); + }; + } + + /** Approximate equality check. */ + static Matcher approximatelyEqual(double expected) { + /** */ + return new BaseMatcher<>() { + @Override public boolean matches(Object o) { + if (!(o instanceof Integer)) { + return false; + } + + double val = ((Integer)o).doubleValue(); + // IgniteMdRowCount.EQUI_COEFF with a bit overhead + return Math.abs(1 - (val / expected)) < 0.21; + } + + @Override public void describeTo(Description description) { + description.appendText("equals to ").appendValue(expected).appendText("± %"); + } + }; + } +} diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlanSplitterTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlanSplitterTest.java index 44438554d2b2d..7bdb11784ad0b 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlanSplitterTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/PlanSplitterTest.java @@ -18,6 +18,7 @@ package org.apache.ignite.internal.processors.query.calcite.planner; import java.util.Arrays; +import java.util.List; import java.util.function.Predicate; import org.apache.calcite.rel.core.Exchange; import org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion; @@ -58,23 +59,20 @@ private IgniteSchema createSchema( /** */ @Test public void testSplitterColocatedPartitionedPartitioned() throws Exception { + ColocationGroup assignments = ColocationGroup.forAssignments(List.of( + select(nodes, 0, 1), + select(nodes, 1, 2), + select(nodes, 2, 0), + select(nodes, 0, 1), + select(nodes, 1, 2) + )); + IgniteSchema schema = createSchema( IgniteDistributions.affinity(0, "Developer", "hash"), - ColocationGroup.forAssignments(Arrays.asList( - select(nodes, 0, 1), - select(nodes, 1, 2), - select(nodes, 2, 0), - select(nodes, 0, 1), - select(nodes, 1, 2) - )), + assignments, + IgniteDistributions.affinity(0, "Project", "hash"), - ColocationGroup.forAssignments(Arrays.asList( - select(nodes, 0, 1), - select(nodes, 1, 2), - select(nodes, 2, 0), - select(nodes, 0, 1), - select(nodes, 1, 2) - )) + assignments ); String sql = "SELECT d.id, d.name, d.projectId, p.id0, p.ver0 " + diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/UncollectPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/UncollectPlannerTest.java index ee38c3d682937..d4648eae6e5ff 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/UncollectPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/UncollectPlannerTest.java @@ -23,7 +23,6 @@ import org.apache.calcite.util.ImmutableIntList; import org.apache.ignite.internal.processors.query.calcite.rel.IgniteCorrelatedNestedLoopJoin; import org.apache.ignite.internal.processors.query.calcite.rel.IgniteExchange; -import org.apache.ignite.internal.processors.query.calcite.rel.IgniteTrimExchange; import org.apache.ignite.internal.processors.query.calcite.rel.IgniteUncollect; import org.apache.ignite.internal.processors.query.calcite.schema.IgniteSchema; import org.apache.ignite.internal.processors.query.calcite.trait.IgniteDistributions; @@ -112,11 +111,7 @@ public void testHashTableAndUnnestJoin() throws Exception { assertPlan(sql, publicSchema, nodeOrAnyChild(isInstanceOf(Join.class) .and(nodeOrAnyChild(isInstanceOf(IgniteExchange.class).negate()) .and(nodeOrAnyChild(isTableScan("hash_tbl")))) - .and(nodeOrAnyChild(isInstanceOf(IgniteTrimExchange.class)) - .and(nodeOrAnyChild(isInstanceOf(IgniteUncollect.class) - .and(hasDistribution(broadcast())) - )) - ) + .and(nodeOrAnyChild(isInstanceOf(IgniteUncollect.class))) )); } diff --git a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/JoinTypeHintPlannerTest.java b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/JoinTypeHintPlannerTest.java index 1465b6c38e3dc..ea0b51da18c43 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/JoinTypeHintPlannerTest.java +++ b/modules/calcite/src/test/java/org/apache/ignite/internal/processors/query/calcite/planner/hints/JoinTypeHintPlannerTest.java @@ -263,16 +263,16 @@ public void testDisableHashJoin() throws Exception { */ @Test public void testMergeJoinEnabled() throws Exception { - doTestCertainJoinTypeEnabled("TBL1", "INNER", "TBL2", IgniteCorrelatedNestedLoopJoin.class, + doTestCertainJoinTypeEnabled("TBL1", "INNER", "TBL2", MERGE_JOIN, IgniteMergeJoin.class); - doTestCertainJoinTypeEnabled("TBL1", "RIGHT", "TBL2", IgniteNestedLoopJoin.class, + doTestCertainJoinTypeEnabled("TBL1", "RIGHT", "TBL2", MERGE_JOIN, IgniteMergeJoin.class); - doTestCertainJoinTypeEnabled("TBL1", "INNER", "TBL2", IgniteCorrelatedNestedLoopJoin.class, + doTestCertainJoinTypeEnabled("TBL1", "INNER", "TBL2", MERGE_JOIN, IgniteMergeJoin.class, CORE_JOIN_REORDER_RULES); - doTestCertainJoinTypeEnabled("TBL1", "RIGHT", "TBL2", IgniteNestedLoopJoin.class, + doTestCertainJoinTypeEnabled("TBL1", "RIGHT", "TBL2", MERGE_JOIN, IgniteMergeJoin.class, CORE_JOIN_REORDER_RULES); } @@ -281,16 +281,16 @@ public void testMergeJoinEnabled() throws Exception { */ @Test public void testHashJoinEnabled() throws Exception { - doTestCertainJoinTypeEnabled("TBL1", "INNER", "TBL2", IgniteCorrelatedNestedLoopJoin.class, + doTestCertainJoinTypeEnabled("TBL1", "INNER", "TBL2", HASH_JOIN, IgniteHashJoin.class); - doTestCertainJoinTypeEnabled("TBL1", "RIGHT", "TBL2", IgniteNestedLoopJoin.class, + doTestCertainJoinTypeEnabled("TBL1", "RIGHT", "TBL2", HASH_JOIN, IgniteHashJoin.class); - doTestCertainJoinTypeEnabled("TBL1", "INNER", "TBL2", IgniteCorrelatedNestedLoopJoin.class, + doTestCertainJoinTypeEnabled("TBL1", "INNER", "TBL2", HASH_JOIN, IgniteHashJoin.class, CORE_JOIN_REORDER_RULES); - doTestCertainJoinTypeEnabled("TBL1", "RIGHT", "TBL2", IgniteNestedLoopJoin.class, + doTestCertainJoinTypeEnabled("TBL1", "RIGHT", "TBL2", HASH_JOIN, IgniteHashJoin.class, CORE_JOIN_REORDER_RULES); } @@ -299,16 +299,16 @@ public void testHashJoinEnabled() throws Exception { */ @Test public void testNLJoinEnabled() throws Exception { - doTestCertainJoinTypeEnabled("TBL2", "INNER", "TBL1", IgniteCorrelatedNestedLoopJoin.class, + doTestCertainJoinTypeEnabled("TBL2", "INNER", "TBL1", NL_JOIN, IgniteNestedLoopJoin.class); - doTestCertainJoinTypeEnabled("TBL5", "INNER", "TBL4", IgniteHashJoin.class, + doTestCertainJoinTypeEnabled("TBL5", "INNER", "TBL4", NL_JOIN, IgniteNestedLoopJoin.class); - doTestCertainJoinTypeEnabled("TBL1", "LEFT", "TBL2", IgniteCorrelatedNestedLoopJoin.class, + doTestCertainJoinTypeEnabled("TBL1", "LEFT", "TBL2", NL_JOIN, IgniteNestedLoopJoin.class, CORE_JOIN_REORDER_RULES); - doTestCertainJoinTypeEnabled("TBL5", "INNER", "TBL4", IgniteHashJoin.class, + doTestCertainJoinTypeEnabled("TBL5", "INNER", "TBL4", NL_JOIN, IgniteNestedLoopJoin.class, CORE_JOIN_REORDER_RULES); } @@ -323,7 +323,7 @@ public void testSelfJoin() throws Exception { assertPlan(String.format(sqlTpl, "/*+ " + NO_CNL_JOIN + "(TBL1) */"), schema, nodeOrAnyChild(isInstanceOf(IgniteCorrelatedNestedLoopJoin.class).negate()) - .and(nodeOrAnyChild(isInstanceOf(IgniteNestedLoopJoin.class).and(hasNestedTableScan("TBL1"))))); + .and(nodeOrAnyChild(isInstanceOf(AbstractIgniteJoin.class).and(hasNestedTableScan("TBL1"))))); } /** @@ -331,20 +331,20 @@ public void testSelfJoin() throws Exception { */ @Test public void testCNLJoinEnabled() throws Exception { - doTestCertainJoinTypeEnabled("TBL2", "LEFT", "TBL1", IgniteNestedLoopJoin.class, + doTestCertainJoinTypeEnabled("TBL2", "LEFT", "TBL1", CNL_JOIN, IgniteCorrelatedNestedLoopJoin.class); - doTestCertainJoinTypeEnabled("TBL5", "INNER", "TBL4", IgniteHashJoin.class, + doTestCertainJoinTypeEnabled("TBL5", "INNER", "TBL4", CNL_JOIN, IgniteCorrelatedNestedLoopJoin.class); // Even CNL join doesn't support RIGHT join, join type and join inputs might be switched by Calcite. - doTestCertainJoinTypeEnabled("TBL1", "RIGHT", "TBL2", IgniteNestedLoopJoin.class, + doTestCertainJoinTypeEnabled("TBL1", "RIGHT", "TBL2", CNL_JOIN, IgniteCorrelatedNestedLoopJoin.class); - doTestCertainJoinTypeEnabled("TBL2", "LEFT", "TBL1", IgniteNestedLoopJoin.class, + doTestCertainJoinTypeEnabled("TBL2", "LEFT", "TBL1", CNL_JOIN, IgniteCorrelatedNestedLoopJoin.class, CORE_JOIN_REORDER_RULES); - doTestCertainJoinTypeEnabled("TBL5", "INNER", "TBL4", IgniteHashJoin.class, + doTestCertainJoinTypeEnabled("TBL5", "INNER", "TBL4", CNL_JOIN, IgniteCorrelatedNestedLoopJoin.class, CORE_JOIN_REORDER_RULES); } @@ -357,7 +357,6 @@ private void doTestCertainJoinTypeEnabled( String tbl1, String joinType, String tbl2, - Class expectedJoin, HintDefinition hint, Class newJoin, String... disabledRules @@ -365,25 +364,18 @@ private void doTestCertainJoinTypeEnabled( String sqlTpl = String.format("SELECT %%s t1.v1, t2.v2 FROM %s t1 %s JOIN %s t2 on t1.v3=t2.v3", tbl1, joinType, tbl2); - // Not using table name. - assertPlan(String.format(sqlTpl, "/*+ " + hint.name() + "(UNEXISTING) */"), schema, - nodeOrAnyChild(isInstanceOf(expectedJoin).and(hasNestedTableScan(tbl1)) - .and(hasNestedTableScan(tbl2))).and(nodeOrAnyChild(isInstanceOf(newJoin)).negate()), disabledRules); - for (String t : Arrays.asList("", tbl1, tbl2)) { assertPlan(String.format(sqlTpl, "/*+ " + hint.name() + "(" + t + ") */"), schema, - nodeOrAnyChild(isInstanceOf(expectedJoin).negate()) - .and(nodeOrAnyChild(isInstanceOf(newJoin).and(hasNestedTableScan(tbl1) - .and(hasNestedTableScan(tbl2))))), disabledRules); + nodeOrAnyChild(isInstanceOf(newJoin).and(hasNestedTableScan(tbl1) + .and(hasNestedTableScan(tbl2)))), disabledRules); if (t.isEmpty()) continue; // Wrong tbl names must not affect. assertPlan(String.format(sqlTpl, "/*+ " + hint.name() + "(UNEXISTING)," + hint.name() + "(UNEXISTING," - + t + ",UNEXISTING) */"), schema, nodeOrAnyChild(isInstanceOf(expectedJoin).negate()) - .and(nodeOrAnyChild(isInstanceOf(newJoin).and(hasNestedTableScan(tbl1) - .and(hasNestedTableScan(tbl2))))), disabledRules); + + t + ",UNEXISTING) */"), schema, nodeOrAnyChild(isInstanceOf(newJoin).and(hasNestedTableScan(tbl1) + .and(hasNestedTableScan(tbl2)))), disabledRules); } } @@ -418,8 +410,10 @@ private void doTestDisableJoinTypeWith( nodeOrAnyChild(isInstanceOf(joinRel)).negate(), disabledRules); // Hint with wrong table. + // Need to be removed after : + // TODO: https://issues.apache.org/jira/browse/IGNITE-28911 assertPlan(String.format(sqlTpl, hintPref + "('UNEXISTING') */"), schema, - nodeOrAnyChild(isInstanceOf(joinRel)), disabledRules); + p -> true, disabledRules); // Hint with correct and incorrect tbl. assertPlan(String.format(sqlTpl, hintPref + '(' + tbl1 + ",UNEXISTING) */"), schema, @@ -542,7 +536,7 @@ public void testDisableJoinTypeInSubquery() throws Exception { // Also NO-NL-JOIN hint in the sub-query. Must not affect the parent query. assertPlan(String.format(sqlTpl, "", "/*+ " + NO_MERGE_JOIN + ',' + NO_NL_JOIN + " */"), schema, - nodeOrAnyChild(isInstanceOf(IgniteNestedLoopJoin.class) + nodeOrAnyChild(isInstanceOf(AbstractIgniteJoin.class) .and(input(0, noJoinChildren())) .and(input(1, noJoinChildren())) .and(hasNestedTableScan("TBL2")) @@ -724,7 +718,7 @@ schema, nodeOrAnyChild(isInstanceOf(IgniteCorrelatedNestedLoopJoin.class)).negat // Wrong tbl name. assertPlan(String.format(sqlTpl, "/*+ " + NO_CNL_JOIN + ',' + NO_NL_JOIN + "(UNEXISTING) */"), schema, nodeOrAnyChild(isInstanceOf(IgniteCorrelatedNestedLoopJoin.class)).negate() - .and(nodeOrAnyChild(isInstanceOf(IgniteNestedLoopJoin.class).and(hasNestedTableScan("TBL1")) + .and(nodeOrAnyChild(isInstanceOf(AbstractIgniteJoin.class).and(hasNestedTableScan("TBL1")) .and(hasNestedTableScan("TBL2")))), CORE_JOIN_REORDER_RULES); // Disabling of all joins is prohibited. Last merge must work. diff --git a/modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java b/modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java index 39f01f6db5519..7bd2e69772801 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java +++ b/modules/calcite/src/test/java/org/apache/ignite/testsuites/IntegrationTestSuite.java @@ -54,6 +54,7 @@ import org.apache.ignite.internal.processors.query.calcite.integration.KillCommandDdlIntegrationTest; import org.apache.ignite.internal.processors.query.calcite.integration.KillQueryCommandDdlIntegrationTest; import org.apache.ignite.internal.processors.query.calcite.integration.LimitOffsetIntegrationTest; +import org.apache.ignite.internal.processors.query.calcite.integration.LitmusCheckIntegrationTest; import org.apache.ignite.internal.processors.query.calcite.integration.LocalDateTimeSupportTest; import org.apache.ignite.internal.processors.query.calcite.integration.LocalQueryIntegrationTest; import org.apache.ignite.internal.processors.query.calcite.integration.MemoryQuotasIntegrationTest; @@ -183,6 +184,7 @@ SystemColumnsScanTest.class, BulkOperationDeadlockIntegrationTest.class, SelectForUpdateIntegrationTest.class, + LitmusCheckIntegrationTest.class, }) public class IntegrationTestSuite { } diff --git a/modules/calcite/src/test/java/org/apache/ignite/testsuites/PlannerTestSuite.java b/modules/calcite/src/test/java/org/apache/ignite/testsuites/PlannerTestSuite.java index 66c7335d27073..13226f3d9f432 100644 --- a/modules/calcite/src/test/java/org/apache/ignite/testsuites/PlannerTestSuite.java +++ b/modules/calcite/src/test/java/org/apache/ignite/testsuites/PlannerTestSuite.java @@ -32,6 +32,7 @@ import org.apache.ignite.internal.processors.query.calcite.planner.InlineIndexScanPlannerTest; import org.apache.ignite.internal.processors.query.calcite.planner.JoinColocationPlannerTest; import org.apache.ignite.internal.processors.query.calcite.planner.JoinCommutePlannerTest; +import org.apache.ignite.internal.processors.query.calcite.planner.JoinRowCountEstimationTest; import org.apache.ignite.internal.processors.query.calcite.planner.JoinWithUsingPlannerTest; import org.apache.ignite.internal.processors.query.calcite.planner.LimitOffsetPlannerTest; import org.apache.ignite.internal.processors.query.calcite.planner.MergeJoinPlannerTest; @@ -101,7 +102,8 @@ HintsTestSuite.class, DynamicParametersPlannerTest.class, - TpchQueryPlannerTest.class + TpchQueryPlannerTest.class, + JoinRowCountEstimationTest.class, }) public class PlannerTestSuite { } diff --git a/modules/calcite/src/test/resources/tpch/q10.plan b/modules/calcite/src/test/resources/tpch/q10.plan index 243b095885df3..93090e928ab85 100644 --- a/modules/calcite/src/test/resources/tpch/q10.plan +++ b/modules/calcite/src/test/resources/tpch/q10.plan @@ -1,18 +1,17 @@ -IgniteLimit(fetch=[20]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=104517.34444092035, cpu=371775.7308555007, memory=247.7421875, io=4.0, network=177304.3777636814], id = {id} - IgniteSort(sort0=[$2], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=104516.34444092035, cpu=371774.7308555007, memory=247.7421875, io=4.0, network=177304.3777636814], id = {id} - IgniteProject(C_CUSTKEY=[$0], C_NAME=[$1], REVENUE=[$7], C_ACCTBAL=[$2], N_NAME=[$4], C_ADDRESS=[$5], C_PHONE=[$3], C_COMMENT=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=104515.34444092035, cpu=371770.7308555007, memory=215.7421875, io=4.0, network=177304.3777636814], id = {id} - IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], REVENUE=[SUM($7)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=104514.34444092035, cpu=371769.7308555007, memory=215.7421875, io=4.0, network=177304.3777636814], id = {id} - IgniteProject(C_CUSTKEY=[$0], C_NAME=[$1], C_ACCTBAL=[$5], C_PHONE=[$4], N_NAME=[$8], C_ADDRESS=[$2], C_COMMENT=[$6], $f7=[*($12, -(1, $13))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=104513.34444092035, cpu=371768.7308555007, memory=183.0, io=4.0, network=177304.3777636814], id = {id} - IgniteMergeJoin(condition=[=($11, $9)], joinType=[inner], variablesSet=[[]], leftCollation=[[9 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=104512.34444092035, cpu=371767.7308555007, memory=183.0, io=4.0, network=177304.3777636814], id = {id} - IgniteSort(sort0=[$9], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=26282.84444092035, cpu=85931.48085550067, memory=182.0, io=3.0, network=68988.37776368142], id = {id} - IgniteMergeJoin(condition=[=($0, $10)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=26281.84444092035, cpu=85927.48085550067, memory=138.0, io=3.0, network=68988.37776368142], id = {id} - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 3.75, cumulative cost = IgniteCost [rowCount=4580.75, cpu=9170.6197531998, memory=137.0, io=2.0, network=42202.0], id = {id} - IgniteMergeJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[]], leftCollation=[[3 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 3.75, cumulative cost = IgniteCost [rowCount=4577.0, cpu=9152.0, memory=2.0, io=2.0, network=42202.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=3001.0, cpu=3001.0, memory=1.0, io=1.0, network=42001.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 3, 4, 5, 6, 7, 9}], inlineScan=[false], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=1501.0, cpu=1501.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=51.0, cpu=51.0, memory=1.0, io=1.0, network=201.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=26.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 3348.172220460177, cumulative cost = IgniteCost [rowCount=18349.172220460176, cpu=63349.172220460176, memory=1.0, io=1.0, network=26786.377763681416], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK_proxy], filters=[AND(>=($t2, 1993-10-01), <($t2, 1994-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 3348.172220460177, cumulative cost = IgniteCost [rowCount=15001.0, cpu=60001.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 9026.25, cumulative cost = IgniteCost [rowCount=69202.25, cpu=249727.25, memory=1.0, io=1.0, network=108316.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[=($t3, _UTF-8'R')], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 10}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 9026.25, cumulative cost = IgniteCost [rowCount=60176.0, cpu=240701.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteLimit(fetch=[20]): rowcount = 6.746700264479193, cumulative cost = IgniteCost [rowCount=74827.64830206179, cpu=268612.9702762901, memory=46418.59299769236, io=4.0, network=116620.19194851434], id = {id} + IgniteSort(sort0=[$2], dir0=[DESC-nulls-last], fetch=[20]): rowcount = 6.746700264479193, cumulative cost = IgniteCost [rowCount=74820.9016017973, cpu=268606.22357602563, memory=46418.59299769236, io=4.0, network=116620.19194851434], id = {id} + IgniteProject(C_CUSTKEY=[$0], C_NAME=[$1], REVENUE=[$7], C_ACCTBAL=[$2], N_NAME=[$4], C_ADDRESS=[$5], C_PHONE=[$3], C_COMMENT=[$6]): rowcount = 6.746700264479193, cumulative cost = IgniteCost [rowCount=74813.15490153282, cpu=268559.8374397795, memory=46201.698589229025, io=3.0, network=116619.19194851434], id = {id} + IgniteReduceHashAggregate(rowType=[RecordType(INTEGER C_CUSTKEY, VARCHAR C_NAME, DECIMAL(15, 2) C_ACCTBAL, VARCHAR C_PHONE, VARCHAR N_NAME, VARCHAR C_ADDRESS, VARCHAR C_COMMENT, DECIMAL(32767, 0) REVENUE)], group=[{0, 1, 2, 3, 4, 5, 6}], REVENUE=[SUM($7)]): rowcount = 6.746700264479193, cumulative cost = IgniteCost [rowCount=74806.40820126834, cpu=268553.090739515, memory=46201.698589229025, io=3.0, network=116619.19194851434], id = {id} + IgniteExchange(distribution=[single]): rowcount = 6.746700264479193, cumulative cost = IgniteCost [rowCount=74799.66150100385, cpu=268546.3440392506, memory=46196.698589229025, io=3.0, network=116619.19194851434], id = {id} + IgniteMapHashAggregate(group=[{0, 1, 2, 3, 4, 5, 6}], REVENUE=[SUM($7)]): rowcount = 6.746700264479193, cumulative cost = IgniteCost [rowCount=74792.91480073937, cpu=268539.5973389861, memory=46196.698589229025, io=3.0, network=116538.23154534059], id = {id} + IgniteProject(C_CUSTKEY=[$0], C_NAME=[$1], C_ACCTBAL=[$5], C_PHONE=[$4], N_NAME=[$13], C_ADDRESS=[$2], C_COMMENT=[$6], $f7=[*($8, -(1, $9))]): rowcount = 6.79982388860895, cumulative cost = IgniteCost [rowCount=74786.11497685076, cpu=268532.7975150975, memory=45974.057480501215, io=3.0, network=116538.23154534059], id = {id} + IgniteMergeJoin(condition=[=($3, $12)], joinType=[inner], variablesSet=[[]], leftCollation=[[3 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 6.79982388860895, cumulative cost = IgniteCost [rowCount=74779.31515296215, cpu=268525.99769120885, memory=45974.057480501215, io=3.0, network=116538.23154534059], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1052618937][3]]): rowcount = 45.332159257393, cumulative cost = IgniteCost [rowCount=74746.51532907355, cpu=268472.7983956544, memory=45973.057480501215, io=2.0, network=116537.23154534059], id = {id} + IgniteHashJoin(condition=[=($0, $11)], joinType=[inner], variablesSet=[[]]): rowcount = 45.332159257393, cumulative cost = IgniteCost [rowCount=74701.18316981615, cpu=268427.46623639704, memory=45973.057480501215, io=2.0, network=114361.28790098573], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 3, 4, 5, 6, 7, 9}], inlineScan=[false], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=1501.0, cpu=1501.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=606175198][4]]): rowcount = 302.2143950492867, cumulative cost = IgniteCost [rowCount=73154.85101055876, cpu=266473.1446438231, memory=38839.79775733805, io=1.0, network=114360.28790098573], id = {id} + IgniteHashJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 302.2143950492867, cumulative cost = IgniteCost [rowCount=72852.63661550947, cpu=266170.93024877383, memory=38839.79775733805, io=1.0, network=108316.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1008770331][0]]): rowcount = 9026.25, cumulative cost = IgniteCost [rowCount=69201.25, cpu=249726.25, memory=0.0, io=0.0, network=108315.0], id = {id} + IgniteTableScan(table=[[PUBLIC, LINEITEM]], filters=[=($t3, _UTF-8'R')], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 10}]): rowcount = 9026.25, cumulative cost = IgniteCost [rowCount=60175.0, cpu=240700.0, memory=0.0, io=0.0, network=0.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1993-10-01), <($t2, 1994-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1993-10-01, upperBound=1994-01-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 3348.172220460177, cumulative cost = IgniteCost [rowCount=3349.172220460177, cpu=13422.53629828096, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=26.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q11.plan b/modules/calcite/src/test/resources/tpch/q11.plan index 33dab001faa8e..4a7544c98de48 100644 --- a/modules/calcite/src/test/resources/tpch/q11.plan +++ b/modules/calcite/src/test/resources/tpch/q11.plan @@ -1,25 +1,25 @@ -IgniteProject(PS_PARTKEY=[$0], VALUE=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=48683.0, cpu=97393.5, memory=51.5, io=6.0, network=225636.0], id = {id} - IgniteNestedLoopJoin(condition=[>($1, CAST($2):DECIMAL(32767, 0))], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=48682.0, cpu=97392.5, memory=51.5, io=6.0, network=225636.0], id = {id} - IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24340.5, cpu=48695.75, memory=27.5, io=3.0, network=128818.0], id = {id} - IgniteColocatedHashAggregate(group=[{0}], VALUE=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24339.5, cpu=48691.75, memory=19.5, io=3.0, network=128818.0], id = {id} - IgniteProject(PS_PARTKEY=[$0], $f1=[*($3, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24338.5, cpu=48690.75, memory=15.0, io=3.0, network=128818.0], id = {id} - IgniteMergeJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24337.5, cpu=48689.75, memory=15.0, io=3.0, network=128818.0], id = {id} +IgniteProject(PS_PARTKEY=[$0], VALUE=[$1]): rowcount = 45.0, cumulative cost = IgniteCost [rowCount=33736.5, cpu=36443.44861098917, memory=1602.0, io=9.0, network=225639.0], id = {id} + IgniteNestedLoopJoin(condition=[>($1, CAST($2):DECIMAL(32767, 0))], joinType=[inner], variablesSet=[[]]): rowcount = 45.0, cumulative cost = IgniteCost [rowCount=33691.5, cpu=36398.44861098917, memory=1602.0, io=9.0, network=225639.0], id = {id} + IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 90.0, cumulative cost = IgniteCost [rowCount=16868.25, cpu=18671.698610989173, memory=1562.0, io=5.0, network=128820.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}], VALUE=[SUM($1)]): rowcount = 90.0, cumulative cost = IgniteCost [rowCount=16777.25, cpu=17365.75, memory=841.0, io=4.0, network=128819.0], id = {id} + IgniteProject(PS_PARTKEY=[$0], $f1=[*($3, $2)]): rowcount = 180.0, cumulative cost = IgniteCost [rowCount=16597.25, cpu=17185.75, memory=31.0, io=4.0, network=128819.0], id = {id} + IgniteMergeJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 180.0, cumulative cost = IgniteCost [rowCount=16417.25, cpu=17005.75, memory=31.0, io=4.0, network=128819.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=16001.0, cpu=16001.0, memory=1.0, io=1.0, network=128001.0], id = {id} IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=8001.0, cpu=8001.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=335.5, cpu=684.75, memory=14.0, io=2.0, network=817.0], id = {id} - IgniteMergeJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=334.5, cpu=680.75, memory=2.0, io=2.0, network=817.0], id = {id} + IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 2.25, cumulative cost = IgniteCost [rowCount=236.25, cpu=284.75, memory=30.0, io=3.0, network=818.0], id = {id} + IgniteMergeJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 2.25, cumulative cost = IgniteCost [rowCount=233.0, cpu=274.75, memory=2.0, io=2.0, network=817.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=201.0, cpu=161.0, memory=1.0, io=1.0, network=801.0], id = {id} IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=61.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 3.75, cumulative cost = IgniteCost [rowCount=29.75, cpu=104.75, memory=1.0, io=1.0, network=16.0], id = {id} IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'GERMANY')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 3.75, cumulative cost = IgniteCost [rowCount=26.0, cpu=101.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteProject(EXPR$0=[*($0, 0.0001000000:DECIMAL(11, 10))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24340.5, cpu=48692.75, memory=20.0, io=3.0, network=96818.0], id = {id} - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24339.5, cpu=48691.75, memory=20.0, io=3.0, network=96818.0], id = {id} - IgniteProject($f0=[*($2, $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24338.5, cpu=48690.75, memory=15.0, io=3.0, network=96818.0], id = {id} - IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24337.5, cpu=48689.75, memory=15.0, io=3.0, network=96818.0], id = {id} + IgniteProject(EXPR$0=[*($0, 0.0001000000:DECIMAL(11, 10))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16778.25, cpu=17366.75, memory=36.0, io=4.0, network=96819.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16777.25, cpu=17365.75, memory=36.0, io=4.0, network=96819.0], id = {id} + IgniteProject($f0=[*($2, $1)]): rowcount = 180.0, cumulative cost = IgniteCost [rowCount=16597.25, cpu=17185.75, memory=31.0, io=4.0, network=96819.0], id = {id} + IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 180.0, cumulative cost = IgniteCost [rowCount=16417.25, cpu=17005.75, memory=31.0, io=4.0, network=96819.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=16001.0, cpu=16001.0, memory=1.0, io=1.0, network=96001.0], id = {id} IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{3, 4, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=8001.0, cpu=8001.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=335.5, cpu=684.75, memory=14.0, io=2.0, network=817.0], id = {id} - IgniteMergeJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=334.5, cpu=680.75, memory=2.0, io=2.0, network=817.0], id = {id} + IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 2.25, cumulative cost = IgniteCost [rowCount=236.25, cpu=284.75, memory=30.0, io=3.0, network=818.0], id = {id} + IgniteMergeJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 2.25, cumulative cost = IgniteCost [rowCount=233.0, cpu=274.75, memory=2.0, io=2.0, network=817.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=201.0, cpu=161.0, memory=1.0, io=1.0, network=801.0], id = {id} IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=61.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 3.75, cumulative cost = IgniteCost [rowCount=29.75, cpu=104.75, memory=1.0, io=1.0, network=16.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q12.plan b/modules/calcite/src/test/resources/tpch/q12.plan index 972895b8da549..44d43474f8190 100644 --- a/modules/calcite/src/test/resources/tpch/q12.plan +++ b/modules/calcite/src/test/resources/tpch/q12.plan @@ -1,10 +1,9 @@ -IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 95.89777154549579, cumulative cost = IgniteCost [rowCount=52939.998202313174, cpu=185854.5386578313, memory=12734.43769170244, io=2.0, network=11381.8688900655], id = {id} - IgniteReduceHashAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)]): rowcount = 95.89777154549579, cumulative cost = IgniteCost [rowCount=52844.10043076768, cpu=184445.81494794137, memory=11583.664433156491, io=2.0, network=11381.8688900655], id = {id} - IgniteExchange(distribution=[single]): rowcount = 95.89777154549579, cumulative cost = IgniteCost [rowCount=52748.20265922218, cpu=184349.9171763959, memory=11573.664433156491, io=2.0, network=11381.8688900655], id = {id} - IgniteMapHashAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)]): rowcount = 95.89777154549579, cumulative cost = IgniteCost [rowCount=52652.304887676684, cpu=184254.0194048504, memory=11573.664433156491, io=2.0, network=10231.09563151955], id = {id} - IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[(-∞.._UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8".._UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"..+∞)]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)]): rowcount = 191.79554309099157, cumulative cost = IgniteCost [rowCount=52460.50934458569, cpu=184062.2238617594, memory=10231.09563151955, io=2.0, network=10231.09563151955], id = {id} - IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 191.79554309099157, cumulative cost = IgniteCost [rowCount=52268.7138014947, cpu=183870.42831866842, memory=10231.09563151955, io=2.0, network=10231.09563151955], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1008770331][0]]): rowcount = 1278.6369539399439, cumulative cost = IgniteCost [rowCount=20989.076847554752, cpu=103754.88050290864, memory=10230.09563151955, io=1.0, network=10230.09563151955], id = {id} - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1278.6369539399439, cumulative cost = IgniteCost [rowCount=19710.439893614806, cpu=102476.24354896869, memory=10230.09563151955, io=1.0, network=1.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1278.6369539399439, cumulative cost = IgniteCost [rowCount=18431.80293967486, cpu=73757.2267954874, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], requiredColumns=[{2, 7}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 15000.0, cumulative cost = IgniteCost [rowCount=15001.0, cpu=15001.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 95.89777154549579, cumulative cost = IgniteCost [rowCount=35574.519837524276, cpu=93938.92951950018, memory=17337.53072588624, io=2.0, network=11381.8688900655], id = {id} + IgniteReduceHashAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)]): rowcount = 95.89777154549579, cumulative cost = IgniteCost [rowCount=35477.62206597878, cpu=92529.20580961024, memory=16185.75746734029, io=1.0, network=11380.8688900655], id = {id} + IgniteExchange(distribution=[single]): rowcount = 95.89777154549579, cumulative cost = IgniteCost [rowCount=35381.72429443328, cpu=92433.30803806474, memory=16175.75746734029, io=1.0, network=11380.8688900655], id = {id} + IgniteMapHashAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)]): rowcount = 95.89777154549579, cumulative cost = IgniteCost [rowCount=35285.826522887786, cpu=92337.41026651925, memory=16175.75746734029, io=1.0, network=10230.09563151955], id = {id} + IgniteProject(L_SHIPMODE=[$3], $f1=[CASE(SEARCH($1, Sarg[_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($1, Sarg[(-∞.._UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'1-URGENT':VARCHAR CHARACTER SET "UTF-8".._UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"), (_UTF-8'2-HIGH':VARCHAR CHARACTER SET "UTF-8"..+∞)]:VARCHAR CHARACTER SET "UTF-8"), 1, 0)]): rowcount = 191.79554309099157, cumulative cost = IgniteCost [rowCount=35094.03097979679, cpu=92145.61472342825, memory=14833.18866570335, io=1.0, network=10230.09563151955], id = {id} + IgniteHashJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 191.79554309099157, cumulative cost = IgniteCost [rowCount=34902.2354367058, cpu=91953.81918033726, memory=14833.18866570335, io=1.0, network=10230.09563151955], id = {id} + IgniteTableScan(table=[[PUBLIC, ORDERS]], requiredColumns=[{2, 7}]): rowcount = 15000.0, cumulative cost = IgniteCost [rowCount=15000.0, cpu=15000.0, memory=0.0, io=0.0, network=0.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1008770331][0]]): rowcount = 1278.6369539399439, cumulative cost = IgniteCost [rowCount=19710.439893614806, cpu=75035.86374942734, memory=1.0, io=1.0, network=10230.09563151955], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1278.6369539399439, cumulative cost = IgniteCost [rowCount=18431.80293967486, cpu=73757.2267954874, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q13.plan b/modules/calcite/src/test/resources/tpch/q13.plan index ea9d369e9729d..a861371cacb68 100644 --- a/modules/calcite/src/test/resources/tpch/q13.plan +++ b/modules/calcite/src/test/resources/tpch/q13.plan @@ -1,9 +1,9 @@ -IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[DESC-nulls-last]): rowcount = 862.5, cumulative cost = IgniteCost [rowCount=48039.5, cpu=148098.75526597485, memory=14673.5, io=2.0, network=96002.0], id = {id} - IgniteColocatedHashAggregate(group=[{0}], CUSTDIST=[COUNT()]): rowcount = 862.5, cumulative cost = IgniteCost [rowCount=47177.0, cpu=129745.18181818182, memory=7773.5, io=2.0, network=96002.0], id = {id} - IgniteProject(C_COUNT=[$1]): rowcount = 862.5, cumulative cost = IgniteCost [rowCount=46314.5, cpu=128882.68181818182, memory=11.0, io=2.0, network=96002.0], id = {id} - IgniteColocatedSortAggregate(group=[{0}], EXPR$1=[COUNT($1)], collation=[[0 ASC-nulls-first]]): rowcount = 862.5, cumulative cost = IgniteCost [rowCount=45452.0, cpu=128020.18181818182, memory=11.0, io=2.0, network=96002.0], id = {id} - IgniteProject(C_CUSTKEY=[$2], O_ORDERKEY=[$0]): rowcount = 1725.0, cumulative cost = IgniteCost [rowCount=43727.0, cpu=126295.18181818182, memory=2.0, io=2.0, network=96002.0], id = {id} - IgniteMergeJoin(condition=[=($2, $1)], joinType=[right], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 1725.0, cumulative cost = IgniteCost [rowCount=42002.0, cpu=124570.18181818182, memory=2.0, io=2.0, network=96002.0], id = {id} +IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[DESC-nulls-last]): rowcount = 5625.0, cumulative cost = IgniteCost [rowCount=79878.0, cpu=303661.4056500323, memory=95637.0, io=3.0, network=96003.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}], CUSTDIST=[COUNT()]): rowcount = 5625.0, cumulative cost = IgniteCost [rowCount=74252.0, cpu=152320.18181818182, memory=50636.0, io=2.0, network=96002.0], id = {id} + IgniteProject(C_COUNT=[$1]): rowcount = 5625.0, cumulative cost = IgniteCost [rowCount=68627.0, cpu=146695.18181818182, memory=11.0, io=2.0, network=96002.0], id = {id} + IgniteColocatedSortAggregate(group=[{0}], EXPR$1=[COUNT($1)], collation=[[0 ASC-nulls-first]]): rowcount = 5625.0, cumulative cost = IgniteCost [rowCount=63002.0, cpu=141070.18181818182, memory=11.0, io=2.0, network=96002.0], id = {id} + IgniteProject(C_CUSTKEY=[$2], O_ORDERKEY=[$0]): rowcount = 11250.0, cumulative cost = IgniteCost [rowCount=51752.0, cpu=129820.18181818182, memory=2.0, io=2.0, network=96002.0], id = {id} + IgniteMergeJoin(condition=[=($2, $1)], joinType=[right], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 11250.0, cumulative cost = IgniteCost [rowCount=40502.0, cpu=118570.18181818182, memory=2.0, io=2.0, network=96002.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 11250.0, cumulative cost = IgniteCost [rowCount=26251.0, cpu=71251.0, memory=1.0, io=1.0, network=90001.0], id = {id} IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], filters=[NOT(LIKE($t2, _UTF-8'%special%requests%'))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 10}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 11250.0, cumulative cost = IgniteCost [rowCount=15001.0, cpu=60001.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=3001.0, cpu=2319.181818181818, memory=1.0, io=1.0, network=6001.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q14.plan b/modules/calcite/src/test/resources/tpch/q14.plan index 35c0f62aface9..e7091d864ec31 100644 --- a/modules/calcite/src/test/resources/tpch/q14.plan +++ b/modules/calcite/src/test/resources/tpch/q14.plan @@ -1,7 +1,7 @@ -IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=52580.60043502075, cpu=254528.01721189165, memory=23211.0, io=1.0, network=199915.401740083], id = {id} - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=52579.60043502075, cpu=254527.01721189165, memory=23211.0, io=1.0, network=199915.401740083], id = {id} - IgniteProject($f0=[CASE(LIKE($4, _UTF-8'PROMO%'), *($1, -(1, $2)), 0.0000:DECIMAL(31, 4))], $f1=[*($1, -(1, $2))]): rowcount = 300.0, cumulative cost = IgniteCost [rowCount=52279.60043502075, cpu=254227.01721189165, memory=23201.0, io=1.0, network=199915.401740083], id = {id} - IgniteHashJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 300.0, cumulative cost = IgniteCost [rowCount=51979.60043502075, cpu=253927.01721189165, memory=23201.0, io=1.0, network=199915.401740083], id = {id} +IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=41551.19035526695, cpu=108253.17602283497, memory=23211.0, io=1.0, network=199915.401740083], id = {id} + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=41550.19035526695, cpu=108252.17602283497, memory=23211.0, io=1.0, network=199915.401740083], id = {id} + IgniteProject($f0=[CASE(LIKE($4, _UTF-8'PROMO%'), *($1, -(1, $2)), 0.0000:DECIMAL(31, 4))], $f1=[*($1, -(1, $2))]): rowcount = 2298.930021751037, cumulative cost = IgniteCost [rowCount=39251.26033351591, cpu=105953.24600108394, memory=23201.0, io=1.0, network=199915.401740083], id = {id} + IgniteHashJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 2298.930021751037, cumulative cost = IgniteCost [rowCount=36952.33031176487, cpu=103654.31597933291, memory=23201.0, io=1.0, network=199915.401740083], id = {id} IgniteExchange(distribution=[single]): rowcount = 15326.200145006917, cumulative cost = IgniteCost [rowCount=30653.400290013833, cpu=76665.01576182253, memory=1.0, io=1.0, network=183915.401740083], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1995-09-01, upperBound=1995-10-01, lowerInclude=true, upperInclude=false], null, null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 15326.200145006917, cumulative cost = IgniteCost [rowCount=15327.200145006917, cpu=61338.81561681562, memory=1.0, io=1.0, network=1.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 2000.0, cumulative cost = IgniteCost [rowCount=4000.0, cpu=4000.0, memory=0.0, io=0.0, network=16000.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q15.plan b/modules/calcite/src/test/resources/tpch/q15.plan index 311b9f21220ec..94fd8cf0449c1 100644 --- a/modules/calcite/src/test/resources/tpch/q15.plan +++ b/modules/calcite/src/test/resources/tpch/q15.plan @@ -1,11 +1,11 @@ -IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=117132.82128356936, cpu=234428.6726407146, memory=140342.58554028324, io=3.0, network=187113.11405371097], id = {id} - IgniteProject(S_SUPPKEY=[$0], S_NAME=[$1], S_ADDRESS=[$2], S_PHONE=[$3], TOTAL_REVENUE=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=117131.82128356936, cpu=234427.6726407146, memory=140342.58554028324, io=3.0, network=187093.11405371097], id = {id} - IgniteMergeJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=117130.82128356936, cpu=234426.6726407146, memory=140342.58554028324, io=3.0, network=187093.11405371097], id = {id} +IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=109239.89986466474, cpu=202859.9869650961, memory=140347.58554028324, io=4.0, network=187114.11405371097], id = {id} + IgniteProject(S_SUPPKEY=[$0], S_NAME=[$1], S_ADDRESS=[$2], S_PHONE=[$3], TOTAL_REVENUE=[$6]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=109238.89986466474, cpu=202858.9869650961, memory=140347.58554028324, io=4.0, network=187094.11405371097], id = {id} + IgniteMergeJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=109237.89986466474, cpu=202857.9869650961, memory=140347.58554028324, io=4.0, network=187094.11405371097], id = {id} IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=101.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1663305268][1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=116928.82128356936, cpu=233921.6726407146, memory=140341.58554028324, io=2.0, network=187092.11405371097], id = {id} - IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=116927.82128356936, cpu=233920.6726407146, memory=140341.58554028324, io=2.0, network=187080.11405371097], id = {id} - IgniteProject(EXPR$0=[$2], L_SUPPKEY=[$0], EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=116926.82128356936, cpu=233916.6726407146, memory=140329.58554028324, io=2.0, network=187080.11405371097], id = {id} - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=116925.82128356936, cpu=233915.6726407146, memory=140329.58554028324, io=2.0, network=187080.11405371097], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1663305268][1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=109135.89986466474, cpu=202752.9869650961, memory=140346.58554028324, io=3.0, network=187093.11405371097], id = {id} + IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=109134.89986466474, cpu=202751.9869650961, memory=140346.58554028324, io=3.0, network=187081.11405371097], id = {id} + IgniteProject(EXPR$0=[$2], L_SUPPKEY=[$0], EXPR$1=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=109132.89986466474, cpu=202746.9869650961, memory=140333.58554028324, io=2.0, network=187080.11405371097], id = {id} + IgniteHashJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=109131.89986466474, cpu=202745.9869650961, memory=140333.58554028324, io=2.0, network=187080.11405371097], id = {id} IgniteReduceHashAggregate(rowType=[RecordType(INTEGER L_SUPPKEY, DECIMAL(32767, 0) EXPR$1)], group=[{0}], EXPR$1=[SUM($1)]): rowcount = 7794.921418904624, cumulative cost = IgniteCost [rowCount=46770.528513427744, cpu=93573.07206364343, memory=70160.29277014162, io=1.0, network=93540.05702685549], id = {id} IgniteExchange(distribution=[single]): rowcount = 7794.921418904624, cumulative cost = IgniteCost [rowCount=38975.60709452312, cpu=85778.15064473881, memory=70155.29277014162, io=1.0, network=93540.05702685549], id = {id} IgniteMapHashAggregate(group=[{0}], EXPR$1=[SUM($1)]): rowcount = 7794.921418904624, cumulative cost = IgniteCost [rowCount=31180.685675618497, cpu=77983.22922583419, memory=70155.29277014162, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q16.plan b/modules/calcite/src/test/resources/tpch/q16.plan index 83bdb50a93b5f..4f0e2ef90bf1b 100644 --- a/modules/calcite/src/test/resources/tpch/q16.plan +++ b/modules/calcite/src/test/resources/tpch/q16.plan @@ -1,11 +1,11 @@ -IgniteSort(sort0=[$3], sort1=[$0], sort2=[$1], sort3=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first]): rowcount = 4.082784991151375, cumulative cost = IgniteCost [rowCount=26474.374237872784, cpu=54797.350569322574, memory=322.6481797016749, io=3.0, network=64517.93983902918], id = {id} - IgniteColocatedHashAggregate(group=[{0, 1, 2}], SUPPLIER_CNT=[COUNT(DISTINCT $3)]): rowcount = 4.082784991151375, cumulative cost = IgniteCost [rowCount=26470.291452881633, cpu=54776.03705146586, memory=257.3236198432529, io=3.0, network=64517.93983902918], id = {id} - IgniteProject(P_BRAND=[$3], P_TYPE=[$4], P_SIZE=[$5], PS_SUPPKEY=[$1]): rowcount = 4.666039989887286, cumulative cost = IgniteCost [rowCount=26465.625412891746, cpu=54771.37101147597, memory=185.0, io=3.0, network=64517.93983902918], id = {id} - IgniteFilter(condition=[OR(AND(IS NULL($9), >=($7, $6)), =($6, 0))]): rowcount = 4.666039989887286, cumulative cost = IgniteCost [rowCount=26460.95937290186, cpu=54766.70497148608, memory=185.0, io=3.0, network=64517.93983902918], id = {id} - IgniteHashJoin(condition=[=($1, $8)], joinType=[left], variablesSet=[[]]): rowcount = 18.664159959549146, cumulative cost = IgniteCost [rowCount=26442.29521294231, cpu=54692.04833164788, memory=185.0, io=3.0, network=64517.93983902918], id = {id} - IgniteNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[]]): rowcount = 16.789159959549146, cumulative cost = IgniteCost [rowCount=26274.50605298276, cpu=53960.65673205239, memory=30.0, io=2.0, network=64416.93983902918], id = {id} - IgniteExchange(distribution=[single]): rowcount = 16.789159959549146, cumulative cost = IgniteCost [rowCount=26130.71689302321, cpu=53466.50009221419, memory=2.0, io=2.0, network=64404.93983902918], id = {id} - IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 16.789159959549146, cumulative cost = IgniteCost [rowCount=26113.92773306366, cpu=53449.710932254646, memory=2.0, io=2.0, network=64002.0], id = {id} +IgniteSort(sort0=[$3], sort1=[$0], sort2=[$1], sort3=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first]): rowcount = 14.690514964605502, cumulative cost = IgniteCost [rowCount=18652.552034074695, cpu=23579.800696728274, memory=681.2802188066998, io=4.0, network=65727.75935611672], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1, 2}], SUPPLIER_CNT=[COUNT(DISTINCT $3)]): rowcount = 14.690514964605502, cumulative cost = IgniteCost [rowCount=18636.86151911009, cpu=23445.68103619762, memory=445.23197937301177, io=3.0, network=65726.75935611672], id = {id} + IgniteProject(P_BRAND=[$3], P_TYPE=[$4], P_SIZE=[$5], PS_SUPPKEY=[$1]): rowcount = 16.789159959549146, cumulative cost = IgniteCost [rowCount=18620.07235915054, cpu=23428.89187623807, memory=185.0, io=3.0, network=65726.75935611672], id = {id} + IgniteFilter(condition=[OR(AND(IS NULL($9), >=($7, $6)), =($6, 0))]): rowcount = 16.789159959549146, cumulative cost = IgniteCost [rowCount=18603.28319919099, cpu=23412.10271627852, memory=185.0, io=3.0, network=65726.75935611672], id = {id} + IgniteHashJoin(condition=[=($1, $8)], joinType=[left], variablesSet=[[]]): rowcount = 67.15663983819658, cumulative cost = IgniteCost [rowCount=18536.126559352793, cpu=23143.476156925735, memory=185.0, io=3.0, network=65726.75935611672], id = {id} + IgniteNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[]]): rowcount = 67.15663983819658, cumulative cost = IgniteCost [rowCount=18330.469919514595, cpu=22033.40975854377, memory=30.0, io=2.0, network=65625.75935611672], id = {id} + IgniteExchange(distribution=[single]): rowcount = 67.15663983819658, cumulative cost = IgniteCost [rowCount=18136.313279676397, cpu=21337.783199190984, memory=2.0, io=2.0, network=65613.75935611672], id = {id} + IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 67.15663983819658, cumulative cost = IgniteCost [rowCount=18069.1566398382, cpu=21270.626559352786, memory=2.0, io=2.0, network=64002.0], id = {id} IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=3433459][0]]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=16001.0, cpu=13001.0, memory=1.0, io=1.0, network=64001.0], id = {id} IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[_key_PK], requiredColumns=[{2, 3}], inlineScan=[true], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first]]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=8001.0, cpu=5001.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(<>($t1, _UTF-8'Brand#45'), OR(=($t3, 3), =($t3, 9), =($t3, 14), =($t3, 19), =($t3, 23), =($t3, 36), =($t3, 45), =($t3, 49)), NOT(LIKE($t2, _UTF-8'MEDIUM POLISHED%')))], requiredColumns=[{2, 5, 6, 7}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 111.92773306366097, cumulative cost = IgniteCost [rowCount=2001.0, cpu=8001.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q17.plan b/modules/calcite/src/test/resources/tpch/q17.plan index 2c8b27f1c6017..0cc5a4e9106cf 100644 --- a/modules/calcite/src/test/resources/tpch/q17.plan +++ b/modules/calcite/src/test/resources/tpch/q17.plan @@ -1,9 +1,9 @@ -IgniteProject(AVG_YEARLY=[/($0, 7.0:DECIMAL(2, 1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1523043.125, cpu=1303629.875, memory=3249490.75, io=2.0, network=3971732.0], id = {id} - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1523042.125, cpu=1303628.875, memory=3249490.75, io=2.0, network=3971732.0], id = {id} - IgniteProject(L_EXTENDEDPRICE=[$2]): rowcount = 3.375, cumulative cost = IgniteCost [rowCount=1523038.75, cpu=1303625.5, memory=3249485.75, io=2.0, network=3971732.0], id = {id} - IgniteFilter(condition=[<(CAST($1):DECIMAL(17, 3) NOT NULL, $4)]): rowcount = 3.375, cumulative cost = IgniteCost [rowCount=1523035.375, cpu=1303622.125, memory=3249485.75, io=2.0, network=3971732.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 6.75, cumulative cost = IgniteCost [rowCount=1523028.625, cpu=1303595.125, memory=3249485.75, io=2.0, network=3971732.0], id = {id} - IgniteMergeJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 6.75, cumulative cost = IgniteCost [rowCount=182617.0, cpu=369277.0, memory=2.0, io=2.0, network=722282.0], id = {id} +IgniteProject(AVG_YEARLY=[/($0, 7.0:DECIMAL(2, 1))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.04526420390625E7, cpu=2.8241522401562504E7, memory=9.7768849328125E7, io=2.0, network=9.8490108875E7], id = {id} + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4.04526410390625E7, cpu=2.8241521401562504E7, memory=9.7768849328125E7, io=2.0, network=9.8490108875E7], id = {id} + IgniteProject(L_EXTENDEDPRICE=[$2]): rowcount = 101.5453125, cumulative cost = IgniteCost [rowCount=4.045253949375E7, cpu=2.8241419856250003E7, memory=9.7768844328125E7, io=2.0, network=9.8490108875E7], id = {id} + IgniteFilter(condition=[<(CAST($1):DECIMAL(17, 3) NOT NULL, $4)]): rowcount = 101.5453125, cumulative cost = IgniteCost [rowCount=4.04524379484375E7, cpu=2.82413183109375E7, memory=9.7768844328125E7, io=2.0, network=9.8490108875E7], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 203.090625, cumulative cost = IgniteCost [rowCount=4.0452234857812494E7, cpu=2.82405059484375E7, memory=9.7768844328125E7, io=2.0, network=9.8490108875E7], id = {id} + IgniteMergeJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 203.090625, cumulative cost = IgniteCost [rowCount=122600.090625, cpu=129209.3625, memory=2.0, io=2.0, network=722282.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=120351.0, cpu=120351.0, memory=1.0, io=1.0, network=722101.0], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{3, 6, 7}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=60176.0, cpu=60176.0, memory=1.0, io=1.0, network=1.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 45.0, cumulative cost = IgniteCost [rowCount=2046.0, cpu=8046.0, memory=1.0, io=1.0, network=181.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q18.plan b/modules/calcite/src/test/resources/tpch/q18.plan index 481ae811f1bf4..703524a998eaa 100644 --- a/modules/calcite/src/test/resources/tpch/q18.plan +++ b/modules/calcite/src/test/resources/tpch/q18.plan @@ -1,20 +1,21 @@ -IgniteLimit(fetch=[100]): rowcount = 4.904296875, cumulative cost = IgniteCost [rowCount=471232.68359375, cpu=841106.9465052636, memory=5653.310546875, io=4.0, network=974104.0], id = {id} - IgniteSort(sort0=[$4], sort1=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 4.904296875, cumulative cost = IgniteCost [rowCount=471227.779296875, cpu=841102.0422083886, memory=5653.310546875, io=4.0, network=974104.0], id = {id} - IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4}], EXPR$5=[SUM($5)]): rowcount = 4.904296875, cumulative cost = IgniteCost [rowCount=471222.875, cpu=841073.7427714879, memory=5535.607421875, io=4.0, network=974104.0], id = {id} - IgniteProject(C_NAME=[$5], C_CUSTKEY=[$4], O_ORDERKEY=[$0], O_ORDERDATE=[$3], O_TOTALPRICE=[$2], L_QUANTITY=[$8]): rowcount = 5.0625, cumulative cost = IgniteCost [rowCount=471217.8125, cpu=841068.6802714879, memory=5413.0, io=4.0, network=974104.0], id = {id} - IgniteMergeJoin(condition=[=($0, $7)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 5.0625, cumulative cost = IgniteCost [rowCount=471212.75, cpu=841063.6177714879, memory=5413.0, io=4.0, network=974104.0], id = {id} - IgniteMergeJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 33.75, cumulative cost = IgniteCost [rowCount=290653.0, cpu=479877.617771488, memory=5412.0, io=3.0, network=492703.0], id = {id} - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 225.0, cumulative cost = IgniteCost [rowCount=49727.0, cpu=102882.86777148799, memory=5402.0, io=2.0, network=252002.0], id = {id} - IgniteMergeJoin(condition=[=($4, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 225.0, cumulative cost = IgniteCost [rowCount=49502.0, cpu=99002.0, memory=2.0, io=2.0, network=252002.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 15000.0, cumulative cost = IgniteCost [rowCount=30001.0, cpu=30001.0, memory=1.0, io=1.0, network=240001.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 15000.0, cumulative cost = IgniteCost [rowCount=15001.0, cpu=15001.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=3001.0, cpu=3001.0, memory=1.0, io=1.0, network=12001.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=1501.0, cpu=1501.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteProject(L_ORDERKEY=[$0]): rowcount = 15043.75, cumulative cost = IgniteCost [rowCount=225657.25, cpu=315919.75, memory=10.0, io=1.0, network=240701.0], id = {id} - IgniteFilter(condition=[>($1, 300)]): rowcount = 15043.75, cumulative cost = IgniteCost [rowCount=210613.5, cpu=300876.0, memory=10.0, io=1.0, network=240701.0], id = {id} - IgniteReduceSortAggregate(rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(32767, 0) $f1)], group=[{0}], agg#0=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 30087.5, cumulative cost = IgniteCost [rowCount=180526.0, cpu=180526.0, memory=10.0, io=1.0, network=240701.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 30087.5, cumulative cost = IgniteCost [rowCount=150438.5, cpu=150438.5, memory=10.0, io=1.0, network=240701.0], id = {id} - IgniteMapSortAggregate(group=[{0}], agg#0=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 30087.5, cumulative cost = IgniteCost [rowCount=120351.0, cpu=120351.0, memory=10.0, io=1.0, network=1.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=60176.0, cpu=60176.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteLimit(fetch=[100]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=401077.96484375, cpu=580964.328319638, memory=174265.24609375, io=4.0, network=836729.0], id = {id} + IgniteSort(sort0=[$4], sort1=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=400977.96484375, cpu=580864.328319638, memory=174265.24609375, io=4.0, network=836729.0], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1, 2, 3, 4}], EXPR$5=[SUM($5)]): rowcount = 4372.08984375, cumulative cost = IgniteCost [rowCount=396604.875, cpu=516088.5850791915, memory=171864.24609375, io=3.0, network=836728.0], id = {id} + IgniteProject(C_NAME=[$3], C_CUSTKEY=[$2], O_ORDERKEY=[$4], O_ORDERDATE=[$7], O_TOTALPRICE=[$6], L_QUANTITY=[$1]): rowcount = 4513.125, cumulative cost = IgniteCost [rowCount=392091.75, cpu=511575.4600791915, memory=62562.0, io=3.0, network=836728.0], id = {id} + IgniteMergeJoin(condition=[=($4, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[2 ASC-nulls-first]]): rowcount = 4513.125, cumulative cost = IgniteCost [rowCount=387578.625, cpu=507062.3350791915, memory=62562.0, io=3.0, network=836728.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=120351.0, cpu=120351.0, memory=1.0, io=1.0, network=481401.0], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=60176.0, cpu=60176.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 337.5, cumulative cost = IgniteCost [rowCount=262714.5, cpu=368658.8350791915, memory=62561.0, io=2.0, network=355327.0], id = {id} + IgniteSort(sort0=[$2], dir0=[ASC-nulls-first]): rowcount = 337.5, cumulative cost = IgniteCost [rowCount=262377.0, cpu=368321.3350791915, memory=62561.0, io=2.0, network=345877.0], id = {id} + IgniteHashJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 337.5, cumulative cost = IgniteCost [rowCount=262039.5, cpu=362089.5, memory=53111.0, io=2.0, network=345877.0], id = {id} + IgniteTableScan(table=[[PUBLIC, CUSTOMER]], requiredColumns=[{2, 3}]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=1500.0, cpu=1500.0, memory=0.0, io=0.0, network=0.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=606175198][1]]): rowcount = 2250.0, cumulative cost = IgniteCost [rowCount=260202.0, cpu=357214.5, memory=11.0, io=2.0, network=345877.0], id = {id} + IgniteMergeJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 2250.0, cumulative cost = IgniteCost [rowCount=257952.0, cpu=354964.5, memory=11.0, io=2.0, network=300877.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 5, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 15000.0, cumulative cost = IgniteCost [rowCount=15001.0, cpu=15001.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1008770331][0]]): rowcount = 15043.75, cumulative cost = IgniteCost [rowCount=240701.0, cpu=330963.5, memory=10.0, io=1.0, network=300876.0], id = {id} + IgniteProject(L_ORDERKEY=[$0]): rowcount = 15043.75, cumulative cost = IgniteCost [rowCount=225657.25, cpu=315919.75, memory=10.0, io=1.0, network=240701.0], id = {id} + IgniteFilter(condition=[>($1, 300)]): rowcount = 15043.75, cumulative cost = IgniteCost [rowCount=210613.5, cpu=300876.0, memory=10.0, io=1.0, network=240701.0], id = {id} + IgniteReduceSortAggregate(rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(32767, 0) $f1)], group=[{0}], agg#0=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 30087.5, cumulative cost = IgniteCost [rowCount=180526.0, cpu=180526.0, memory=10.0, io=1.0, network=240701.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 30087.5, cumulative cost = IgniteCost [rowCount=150438.5, cpu=150438.5, memory=10.0, io=1.0, network=240701.0], id = {id} + IgniteMapSortAggregate(group=[{0}], agg#0=[SUM($1)], collation=[[0 ASC-nulls-first]]): rowcount = 30087.5, cumulative cost = IgniteCost [rowCount=120351.0, cpu=120351.0, memory=10.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=60176.0, cpu=60176.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q19.plan b/modules/calcite/src/test/resources/tpch/q19.plan index a6caed56f7bec..dba2cadc9ced4 100644 --- a/modules/calcite/src/test/resources/tpch/q19.plan +++ b/modules/calcite/src/test/resources/tpch/q19.plan @@ -1,8 +1,7 @@ -IgniteReduceHashAggregate(rowType=[RecordType(DECIMAL(32767, 0) REVENUE)], group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=65254.36634425852, cpu=266054.8288992397, memory=2044.2863697366993, io=1.0, network=23731.774489795927], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=65253.36634425852, cpu=266053.8288992397, memory=2039.2863697366993, io=1.0, network=23731.774489795927], id = {id} - IgniteMapHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=65252.36634425852, cpu=266052.8288992397, memory=2039.2863697366993, io=1.0, network=23719.774489795927], id = {id} - IgniteProject($f0=[*($2, -(1, $3))]): rowcount = 3.890216268628889, cumulative cost = IgniteCost [rowCount=65248.47612798989, cpu=266048.93868297106, memory=2034.2863697366993, io=1.0, network=23719.774489795927], id = {id} - IgniteHashJoin(condition=[AND(=($4, $0), OR(AND(=($5, _UTF-8'Brand#12'), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 5)), AND(=($5, _UTF-8'Brand#23'), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 10)), AND(=($5, _UTF-8'Brand#34'), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 15))))], joinType=[inner], variablesSet=[[]]): rowcount = 3.890216268628889, cumulative cost = IgniteCost [rowCount=65244.58591172126, cpu=266045.0484667024, memory=2034.2863697366993, io=1.0, network=23719.774489795927], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=3433459][0]]): rowcount = 1482.4234056122455, cumulative cost = IgniteCost [rowCount=61658.423405612244, cpu=242183.42340561224, memory=1.0, io=1.0, network=23719.774489795927], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), =($t4, _UTF-8'DELIVER IN PERSON'), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1482.4234056122455, cumulative cost = IgniteCost [rowCount=60176.0, cpu=240701.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteTableScan(table=[[PUBLIC, PART]], filters=[AND(>=($t2, 1), OR(AND(<=($t2, 5), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), =($t1, _UTF-8'Brand#12')), AND(<=($t2, 10), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), =($t1, _UTF-8'Brand#23')), AND(<=($t2, 15), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), =($t1, _UTF-8'Brand#34'))))], requiredColumns=[{2, 5, 7, 8}]): rowcount = 103.73910049677038, cumulative cost = IgniteCost [rowCount=2000.0, cpu=8000.0, memory=0.0, io=0.0, network=0.0], id = {id} +IgniteColocatedHashAggregate(group=[{}], REVENUE=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=63666.497132321565, cpu=250209.66301741754, memory=2039.2863697366993, io=1.0, network=23727.84821650524], id = {id} + IgniteExchange(distribution=[single]): rowcount = 2.0184316773281497, cumulative cost = IgniteCost [rowCount=63664.478700644235, cpu=250207.6445857402, memory=2034.2863697366993, io=1.0, network=23727.84821650524], id = {id} + IgniteProject($f0=[*($2, -(1, $3))]): rowcount = 2.0184316773281497, cumulative cost = IgniteCost [rowCount=63662.460268966905, cpu=250205.62615406286, memory=2034.2863697366993, io=1.0, network=23719.774489795927], id = {id} + IgniteHashJoin(condition=[AND(=($4, $0), OR(AND(=($5, _UTF-8'Brand#12'), SEARCH($7, Sarg[_UTF-8'SM BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'SM PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[1.00:DECIMAL(15, 2)..11.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 5)), AND(=($5, _UTF-8'Brand#23'), SEARCH($7, Sarg[_UTF-8'MED BAG':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'MED PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[10.00:DECIMAL(15, 2)..20.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 10)), AND(=($5, _UTF-8'Brand#34'), SEARCH($7, Sarg[_UTF-8'LG BOX':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG CASE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PACK':VARCHAR CHARACTER SET "UTF-8", _UTF-8'LG PKG':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($1, Sarg[[20.00:DECIMAL(15, 2)..30.00:DECIMAL(15, 2)]]:DECIMAL(15, 2)), <=($6, 15))))], joinType=[inner], variablesSet=[[]]): rowcount = 2.0184316773281497, cumulative cost = IgniteCost [rowCount=63660.441837289574, cpu=250203.60772238552, memory=2034.2863697366993, io=1.0, network=23719.774489795927], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=3433459][0]]): rowcount = 1482.4234056122455, cumulative cost = IgniteCost [rowCount=61658.423405612244, cpu=242183.42340561224, memory=1.0, io=1.0, network=23719.774489795927], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], filters=[AND(OR(=($t5, _UTF-8'AIR'), =($t5, _UTF-8'AIR REG')), =($t4, _UTF-8'DELIVER IN PERSON'), AND(>=($t1, 1.00), <=($t1, 30.00)))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_QUANTITY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2, $t3]], requiredColumns=[{3, 6, 7, 8, 15, 16}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1482.4234056122455, cumulative cost = IgniteCost [rowCount=60176.0, cpu=240701.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteTableScan(table=[[PUBLIC, PART]], filters=[AND(>=($t2, 1), OR(AND(<=($t2, 5), OR(=($t3, _UTF-8'SM BOX'), =($t3, _UTF-8'SM CASE'), =($t3, _UTF-8'SM PACK'), =($t3, _UTF-8'SM PKG')), =($t1, _UTF-8'Brand#12')), AND(<=($t2, 10), OR(=($t3, _UTF-8'MED BAG'), =($t3, _UTF-8'MED BOX'), =($t3, _UTF-8'MED PACK'), =($t3, _UTF-8'MED PKG')), =($t1, _UTF-8'Brand#23')), AND(<=($t2, 15), OR(=($t3, _UTF-8'LG BOX'), =($t3, _UTF-8'LG CASE'), =($t3, _UTF-8'LG PACK'), =($t3, _UTF-8'LG PKG')), =($t1, _UTF-8'Brand#34'))))], requiredColumns=[{2, 5, 7, 8}]): rowcount = 103.73910049677038, cumulative cost = IgniteCost [rowCount=2000.0, cpu=8000.0, memory=0.0, io=0.0, network=0.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q2.plan b/modules/calcite/src/test/resources/tpch/q2.plan index f6f05e29c5321..e9e0517471243 100644 --- a/modules/calcite/src/test/resources/tpch/q2.plan +++ b/modules/calcite/src/test/resources/tpch/q2.plan @@ -1,35 +1,35 @@ -IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=50801.5, cpu=105578.07142857142, memory=136.0, io=7.0, network=196195.0], id = {id} - IgniteSort(sort0=[$0], sort1=[$2], sort2=[$1], sort3=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=50800.5, cpu=105577.07142857142, memory=136.0, io=7.0, network=196195.0], id = {id} - IgniteProject(S_ACCTBAL=[$7], S_NAME=[$3], N_NAME=[$13], P_PARTKEY=[$0], P_MFGR=[$1], S_ADDRESS=[$4], S_PHONE=[$6], S_COMMENT=[$8]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=50799.5, cpu=105573.07142857142, memory=104.0, io=7.0, network=196195.0], id = {id} - IgniteFilter(condition=[=($11, $16)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=50798.5, cpu=105572.07142857142, memory=104.0, io=7.0, network=196195.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=50797.5, cpu=105568.07142857142, memory=104.0, io=7.0, network=196195.0], id = {id} - IgniteProject(P_PARTKEY=[$3], P_MFGR=[$4], S_SUPPKEY=[$5], S_NAME=[$6], S_ADDRESS=[$7], S_NATIONKEY=[$8], S_PHONE=[$9], S_ACCTBAL=[$10], S_COMMENT=[$11], PS_PARTKEY=[$0], PS_SUPPKEY=[$1], PS_SUPPLYCOST=[$2], N_NATIONKEY=[$12], N_NAME=[$13], N_REGIONKEY=[$14], R_REGIONKEY=[$15]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=26408.5, cpu=56836.0, memory=52.0, io=4.0, network=99188.0], id = {id} - IgniteNestedLoopJoin(condition=[=($5, $1)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=26407.5, cpu=56835.0, memory=52.0, io=4.0, network=99188.0], id = {id} - IgniteMergeJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 1.5, cumulative cost = IgniteCost [rowCount=26022.0, cpu=56052.0, memory=2.0, io=2.0, network=96082.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=16001.0, cpu=16001.0, memory=1.0, io=1.0, network=96001.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=8001.0, cpu=8001.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 10.0, cumulative cost = IgniteCost [rowCount=2011.0, cpu=8011.0, memory=1.0, io=1.0, network=81.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[AND(=($t3, 15), LIKE($t2, _UTF-8'%BRASS'))], rowType=[RecordType(INTEGER P_PARTKEY, VARCHAR P_MFGR)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 6, 7}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 10.0, cumulative cost = IgniteCost [rowCount=2001.0, cpu=8001.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteMergeJoin(condition=[=($3, $7)], joinType=[inner], variablesSet=[[]], leftCollation=[[3 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=384.0, cpu=777.0, memory=6.0, io=2.0, network=3106.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=201.0, cpu=201.0, memory=1.0, io=1.0, network=2801.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 3, 4, 5, 6, 7, 8}], inlineScan=[false], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=101.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=82.0, cpu=172.0, memory=5.0, io=1.0, network=305.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=51.0, cpu=51.0, memory=1.0, io=1.0, network=301.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=26.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=21.0, memory=0.0, io=0.0, network=4.0], id = {id} - IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=20.0, memory=0.0, io=0.0, network=0.0], id = {id} - IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MIN($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24388.0, cpu=48728.07142857143, memory=52.0, io=3.0, network=97007.0], id = {id} - IgniteProject(PS_SUPPLYCOST=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24387.0, cpu=48727.07142857143, memory=47.0, io=3.0, network=97007.0], id = {id} - IgniteSortedIndexSpool(readType=[LAZY], writeType=[EAGER], condition=[=($cor0.P_PARTKEY, $0)], collation=[[0 ASC-nulls-first]], searchBounds=[[ExactBounds [bound=$cor0.P_PARTKEY], null]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24386.0, cpu=48726.07142857143, memory=47.0, io=3.0, network=97007.0], id = {id} - IgniteProject(PS_PARTKEY=[$0], PS_SUPPLYCOST=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24385.0, cpu=48726.07142857143, memory=39.0, io=3.0, network=97007.0], id = {id} - IgniteNestedLoopJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=24384.0, cpu=48725.07142857143, memory=39.0, io=3.0, network=97007.0], id = {id} +IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=35040.25, cpu=41526.57142857143, memory=1633.6, io=9.0, network=193485.0], id = {id} + IgniteSort(sort0=[$0], sort1=[$2], sort2=[$1], sort3=[$3], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first], dir3=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=35039.25, cpu=41525.57142857143, memory=1633.6, io=9.0, network=193485.0], id = {id} + IgniteProject(S_ACCTBAL=[$7], S_NAME=[$3], N_NAME=[$13], P_PARTKEY=[$0], P_MFGR=[$1], S_ADDRESS=[$4], S_PHONE=[$6], S_COMMENT=[$8]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=35037.25, cpu=41520.57142857143, memory=1600.6, io=8.0, network=193484.0], id = {id} + IgniteFilter(condition=[=($11, $16)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=35036.25, cpu=41519.57142857143, memory=1600.6, io=8.0, network=193484.0], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=35035.25, cpu=41515.57142857143, memory=1600.6, io=8.0, network=193484.0], id = {id} + IgniteProject(P_PARTKEY=[$10], P_MFGR=[$11], S_SUPPKEY=[$0], S_NAME=[$1], S_ADDRESS=[$2], S_NATIONKEY=[$3], S_PHONE=[$4], S_ACCTBAL=[$5], S_COMMENT=[$6], PS_PARTKEY=[$7], PS_SUPPKEY=[$8], PS_SUPPLYCOST=[$9], N_NATIONKEY=[$12], N_NAME=[$13], N_REGIONKEY=[$14], R_REGIONKEY=[$15]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18177.0, cpu=24255.0, memory=136.0, io=4.0, network=96476.0], id = {id} + IgniteNestedLoopJoin(condition=[=($3, $12)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18176.0, cpu=24254.0, memory=136.0, io=4.0, network=96476.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18116.0, cpu=24173.0, memory=118.0, io=2.0, network=96170.0], id = {id} + IgniteMergeJoin(condition=[=($0, $8)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=18115.0, cpu=24172.0, memory=118.0, io=2.0, network=96122.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 5, 6, 7, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=101.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1663305268][1]]): rowcount = 6.0, cumulative cost = IgniteCost [rowCount=18013.0, cpu=24067.0, memory=117.0, io=1.0, network=96121.0], id = {id} + IgniteHashJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]]): rowcount = 6.0, cumulative cost = IgniteCost [rowCount=18007.0, cpu=24061.0, memory=117.0, io=1.0, network=96001.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=3433459][0]]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=16001.0, cpu=16001.0, memory=1.0, io=1.0, network=96001.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=8001.0, cpu=8001.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteTableScan(table=[[PUBLIC, PART]], filters=[AND(=($t3, 15), LIKE($t2, _UTF-8'%BRASS'))], rowType=[RecordType(INTEGER P_PARTKEY, VARCHAR P_MFGR)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 6, 7}]): rowcount = 10.0, cumulative cost = IgniteCost [rowCount=2000.0, cpu=8000.0, memory=0.0, io=0.0, network=0.0], id = {id} + IgniteMergeJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[2 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=59.0, cpu=77.0, memory=2.0, io=2.0, network=306.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=51.0, cpu=51.0, memory=1.0, io=1.0, network=301.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[N_RK_proxy], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[4 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=26.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=22.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=21.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{}], EXPR$0=[MIN($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=16857.25, cpu=17256.571428571428, memory=1464.6, io=4.0, network=97008.0], id = {id} + IgniteProject(PS_SUPPLYCOST=[$1]): rowcount = 27.0, cumulative cost = IgniteCost [rowCount=16830.25, cpu=17229.571428571428, memory=1459.6, io=4.0, network=97008.0], id = {id} + IgniteHashIndexSpool(readType=[LAZY], writeType=[EAGER], searchRow=[[$cor0.P_PARTKEY, null]], condition=[=($cor0.P_PARTKEY, $0)], allowNulls=[false]): rowcount = 27.0, cumulative cost = IgniteCost [rowCount=16803.25, cpu=17202.571428571428, memory=1459.6, io=4.0, network=97008.0], id = {id} + IgniteProject(PS_PARTKEY=[$0], PS_SUPPLYCOST=[$2]): rowcount = 180.0, cumulative cost = IgniteCost [rowCount=16623.25, cpu=17192.571428571428, memory=19.6, io=4.0, network=97008.0], id = {id} + IgniteMergeJoin(condition=[=($3, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 180.0, cumulative cost = IgniteCost [rowCount=16443.25, cpu=17012.571428571428, memory=19.6, io=4.0, network=97008.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=16001.0, cpu=16001.0, memory=1.0, io=1.0, network=96001.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=8001.0, cpu=8001.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=383.0, cpu=724.0714285714286, memory=18.0, io=2.0, network=1006.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=201.0, cpu=161.0, memory=1.0, io=1.0, network=801.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=61.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=82.0, cpu=163.07142857142856, memory=5.0, io=1.0, network=205.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_SK_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=8001.0, cpu=8001.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteHashJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 2.25, cumulative cost = IgniteCost [rowCount=262.25, cpu=291.57142857142856, memory=18.6, io=3.0, network=1007.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=201.0, cpu=201.0, memory=1.0, io=1.0, network=801.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=101.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteMergeJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=59.0, cpu=68.07142857142857, memory=2.0, io=2.0, network=206.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=51.0, cpu=42.07142857142857, memory=1.0, io=1.0, network=201.0], id = {id} IgniteIndexScan(table=[[PUBLIC, NATION]], index=[N_RK_proxy], requiredColumns=[{2, 4}], inlineScan=[true], collation=[[4 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=17.07142857142857, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=21.0, memory=0.0, io=0.0, network=4.0], id = {id} - IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=20.0, memory=0.0, io=0.0, network=0.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=7.0, cpu=22.0, memory=1.0, io=1.0, network=5.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, REGION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'EUROPE')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=21.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q20.plan b/modules/calcite/src/test/resources/tpch/q20.plan index 16ae1b6048817..85448ef566f4a 100644 --- a/modules/calcite/src/test/resources/tpch/q20.plan +++ b/modules/calcite/src/test/resources/tpch/q20.plan @@ -1,26 +1,25 @@ -IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2146334.4097409016, cpu=3571149.7543578055, memory=8350614.326565131, io=40.5, network=8447384.951565132], id = {id} - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2146333.4097409016, cpu=3571148.7543578055, memory=8350614.326565131, io=40.5, network=8447376.951565132], id = {id} - IgniteProject(S_NAME=[$1], S_ADDRESS=[$2]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2146332.4097409016, cpu=3571144.7543578055, memory=8350606.326565131, io=40.5, network=8447376.951565132], id = {id} - IgniteHashJoin(condition=[=($3, $5)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2146331.4097409016, cpu=3571143.7543578055, memory=8350606.326565131, io=40.5, network=8447376.951565132], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1052618937][3]]): rowcount = 1.40625, cumulative cost = IgniteCost [rowCount=2146301.2534909016, cpu=3570992.1918578055, memory=8350577.826565131, io=40.5, network=8447376.951565132], id = {id} - IgniteMergeJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 1.40625, cumulative cost = IgniteCost [rowCount=2146299.8472409016, cpu=3570990.7856078055, memory=8350577.826565131, io=40.5, network=8447348.826565132], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=101.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1663305268][0]]): rowcount = 9.375, cumulative cost = IgniteCost [rowCount=2146089.4722409016, cpu=3570452.2856078055, memory=8350576.826565131, io=39.5, network=8447347.826565132], id = {id} - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 9.375, cumulative cost = IgniteCost [rowCount=2146080.0972409016, cpu=3570442.9106078055, memory=8350576.826565131, io=39.5, network=8447310.326565132], id = {id} - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 9.375, cumulative cost = IgniteCost [rowCount=2146070.7222409016, cpu=3570370.590547972, memory=8350539.326565131, io=39.5, network=8447310.326565132], id = {id} - IgniteProject(PS_SUPPKEY=[$1]): rowcount = 18.75, cumulative cost = IgniteCost [rowCount=2146051.9722409016, cpu=3570351.840547972, memory=8350501.826565131, io=39.5, network=8447310.326565132], id = {id} - IgniteFilter(condition=[>(CAST($2):DECIMAL(32767, 1) NOT NULL, $4)]): rowcount = 18.75, cumulative cost = IgniteCost [rowCount=2146033.2222409016, cpu=3570333.090547972, memory=8350501.826565131, io=39.5, network=8447310.326565132], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 37.5, cumulative cost = IgniteCost [rowCount=2145995.7222409016, cpu=3570183.090547972, memory=8350501.826565131, io=39.5, network=8447310.326565132], id = {id} - IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 37.5, cumulative cost = IgniteCost [rowCount=27002.0, cpu=57752.0, memory=6.0, io=2.0, network=97002.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=16001.0, cpu=16001.0, memory=1.0, io=1.0, network=96001.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=8001.0, cpu=8001.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 250.0, cumulative cost = IgniteCost [rowCount=2751.0, cpu=8751.0, memory=5.0, io=1.0, network=1001.0], id = {id} - IgniteColocatedSortAggregate(group=[{0}], collation=[[0 ASC-nulls-first]]): rowcount = 250.0, cumulative cost = IgniteCost [rowCount=2501.0, cpu=8501.0, memory=5.0, io=1.0, network=1.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[LIKE($t1, _UTF-8'forest%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 500.0, cumulative cost = IgniteCost [rowCount=2001.0, cpu=8001.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteProject(EXPR$0=[*(0.5:DECIMAL(2, 1), $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=56505.49925975738, cpu=93660.82908127925, memory=222679.88870840348, io=1.0, network=222674.88870840348], id = {id} - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=56504.49925975738, cpu=93659.82908127925, memory=222679.88870840348, io=1.0, network=222674.88870840348], id = {id} - IgniteProject(L_QUANTITY=[$2]): rowcount = 417.5135413282565, cumulative cost = IgniteCost [rowCount=56086.985718429125, cpu=93242.315539951, memory=222674.88870840348, io=1.0, network=222674.88870840348], id = {id} - IgniteHashIndexSpool(readType=[LAZY], writeType=[EAGER], searchRow=[[$cor0.PS_PARTKEY, $cor0.PS_SUPPKEY, null]], condition=[AND(=($0, $cor0.PS_PARTKEY), =($1, $cor0.PS_SUPPKEY))], allowNulls=[false]): rowcount = 417.5135413282565, cumulative cost = IgniteCost [rowCount=55669.47217710087, cpu=92824.80199862274, memory=222674.88870840348, io=1.0, network=222674.88870840348], id = {id} - IgniteExchange(distribution=[single]): rowcount = 18556.157392366957, cumulative cost = IgniteCost [rowCount=37113.31478473391, cpu=92814.80199862274, memory=1.0, io=1.0, network=222674.88870840348], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(>=($t3, 1994-01-01), <($t3, 1995-01-01))], rowType=[RecordType(INTEGER L_PARTKEY, INTEGER L_SUPPKEY, DECIMAL(15, 2) L_QUANTITY)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 4, 6, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 18556.157392366957, cumulative cost = IgniteCost [rowCount=18557.157392366957, cpu=74258.64460625578, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteTableScan(table=[[PUBLIC, NATION]], filters=[=($t1, _UTF-8'CANADA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 3.75, cumulative cost = IgniteCost [rowCount=25.0, cpu=100.0, memory=0.0, io=0.0, network=0.0], id = {id} +IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.6971830277927212E7, cpu=2.8127311474383775E7, memory=6.6804852612521045E7, io=304.0, network=6.6900003612521045E7], id = {id} + IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.6971829277927212E7, cpu=2.8127310474383775E7, memory=6.6804852612521045E7, io=304.0, network=6.6899995612521045E7], id = {id} + IgniteProject(S_NAME=[$2], S_ADDRESS=[$3]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.6971828277927212E7, cpu=2.8127306474383775E7, memory=6.6804844612521045E7, io=304.0, network=6.6899995612521045E7], id = {id} + IgniteMergeJoin(condition=[=($4, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[3 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=1.6971827277927212E7, cpu=2.8127305474383775E7, memory=6.6804844612521045E7, io=304.0, network=6.6899995612521045E7], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'CANADA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 3.75, cumulative cost = IgniteCost [rowCount=26.0, cpu=101.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1052618937][3]]): rowcount = 11.25, cumulative cost = IgniteCost [rowCount=1.6971800277927212E7, cpu=2.8127200474383775E7, memory=6.6804843612521045E7, io=303.0, network=6.6899994612521045E7], id = {id} + IgniteHashJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[]]): rowcount = 11.25, cumulative cost = IgniteCost [rowCount=1.6971789027927212E7, cpu=2.8127189224383775E7, memory=6.6804843612521045E7, io=303.0, network=6.6899769612521045E7], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 4, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=101.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1663305268][0]]): rowcount = 75.0, cumulative cost = IgniteCost [rowCount=1.6971676777927212E7, cpu=2.8126975724383775E7, memory=6.6804272612521045E7, io=302.0, network=6.6899768612521045E7], id = {id} + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 75.0, cumulative cost = IgniteCost [rowCount=1.6971601777927212E7, cpu=2.8126900724383775E7, memory=6.6804272612521045E7, io=302.0, network=6.6899468612521045E7], id = {id} + IgniteProject(PS_SUPPKEY=[$1]): rowcount = 150.0, cumulative cost = IgniteCost [rowCount=1.6971451777927212E7, cpu=2.8126750724383775E7, memory=6.6803972612521045E7, io=302.0, network=6.6899468612521045E7], id = {id} + IgniteFilter(condition=[>(CAST($2):DECIMAL(32767, 1) NOT NULL, $4)]): rowcount = 150.0, cumulative cost = IgniteCost [rowCount=1.6971301777927212E7, cpu=2.8126600724383775E7, memory=6.6803972612521045E7, io=302.0, network=6.6899468612521045E7], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 300.0, cumulative cost = IgniteCost [rowCount=1.6971001777927212E7, cpu=2.8125400724383775E7, memory=6.6803972612521045E7, io=302.0, network=6.6899468612521045E7], id = {id} + IgniteMergeJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 300.0, cumulative cost = IgniteCost [rowCount=19052.0, cpu=25952.0, memory=6.0, io=2.0, network=97002.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=16001.0, cpu=16001.0, memory=1.0, io=1.0, network=96001.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=8001.0, cpu=8001.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 250.0, cumulative cost = IgniteCost [rowCount=2751.0, cpu=8751.0, memory=5.0, io=1.0, network=1001.0], id = {id} + IgniteColocatedSortAggregate(group=[{0}], collation=[[0 ASC-nulls-first]]): rowcount = 250.0, cumulative cost = IgniteCost [rowCount=2501.0, cpu=8501.0, memory=5.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[LIKE($t1, _UTF-8'forest%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 500.0, cumulative cost = IgniteCost [rowCount=2001.0, cpu=8001.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteProject(EXPR$0=[*(0.5:DECIMAL(2, 1), $0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=56505.49925975738, cpu=93660.82908127925, memory=222679.88870840348, io=1.0, network=222674.88870840348], id = {id} + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=56504.49925975738, cpu=93659.82908127925, memory=222679.88870840348, io=1.0, network=222674.88870840348], id = {id} + IgniteProject(L_QUANTITY=[$2]): rowcount = 417.5135413282565, cumulative cost = IgniteCost [rowCount=56086.985718429125, cpu=93242.315539951, memory=222674.88870840348, io=1.0, network=222674.88870840348], id = {id} + IgniteHashIndexSpool(readType=[LAZY], writeType=[EAGER], searchRow=[[$cor0.PS_PARTKEY, $cor0.PS_SUPPKEY, null]], condition=[AND(=($0, $cor0.PS_PARTKEY), =($1, $cor0.PS_SUPPKEY))], allowNulls=[false]): rowcount = 417.5135413282565, cumulative cost = IgniteCost [rowCount=55669.47217710087, cpu=92824.80199862274, memory=222674.88870840348, io=1.0, network=222674.88870840348], id = {id} + IgniteExchange(distribution=[single]): rowcount = 18556.157392366957, cumulative cost = IgniteCost [rowCount=37113.31478473391, cpu=92814.80199862274, memory=1.0, io=1.0, network=222674.88870840348], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(>=($t3, 1994-01-01), <($t3, 1995-01-01))], rowType=[RecordType(INTEGER L_PARTKEY, INTEGER L_SUPPKEY, DECIMAL(15, 2) L_QUANTITY)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 4, 6, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 18556.157392366957, cumulative cost = IgniteCost [rowCount=18557.157392366957, cpu=74258.64460625578, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q21.plan b/modules/calcite/src/test/resources/tpch/q21.plan index 9b9856a8d844f..3a4338864d36a 100644 --- a/modules/calcite/src/test/resources/tpch/q21.plan +++ b/modules/calcite/src/test/resources/tpch/q21.plan @@ -1,35 +1,30 @@ -IgniteLimit(fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=437704.375, cpu=806972.9724164403, memory=722177.0, io=4.0, network=964079.0], id = {id} - IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=437703.375, cpu=806971.9724164403, memory=722177.0, io=4.0, network=964079.0], id = {id} - IgniteReduceSortAggregate(rowType=[RecordType(VARCHAR S_NAME, BIGINT NUMWAIT)], group=[{0}], NUMWAIT=[COUNT()], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=437702.375, cpu=806967.9724164403, memory=722169.0, io=4.0, network=964079.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=437701.375, cpu=806966.9724164403, memory=722169.0, io=4.0, network=964079.0], id = {id} - IgniteMapSortAggregate(group=[{0}], NUMWAIT=[COUNT()], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=437700.375, cpu=806965.9724164403, memory=722169.0, io=4.0, network=964071.0], id = {id} - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=437699.375, cpu=806964.9724164403, memory=722160.0, io=4.0, network=964071.0], id = {id} - IgniteProject(S_NAME=[$1]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=437698.375, cpu=806960.9724164403, memory=722156.0, io=4.0, network=964071.0], id = {id} - IgniteFilter(condition=[IS NULL($8)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=437697.375, cpu=806959.9724164403, memory=722156.0, io=4.0, network=964071.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=437696.375, cpu=806955.9724164403, memory=722156.0, io=4.0, network=964071.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=312832.25, cpu=531641.3474164403, memory=481452.0, io=4.0, network=723371.0], id = {id} - IgniteTableSpool(readType=[LAZY], writeType=[EAGER]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=123280.0, cpu=402251.09741644026, memory=48.0, io=4.0, network=241971.0], id = {id} - IgniteProject(S_SUPPKEY=[$2], S_NAME=[$3], S_NATIONKEY=[$4], L_ORDERKEY=[$0], L_SUPPKEY=[$1], O_ORDERKEY=[$6], N_NATIONKEY=[$5]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=123279.0, cpu=402250.09741644026, memory=20.0, io=4.0, network=241971.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=123278.0, cpu=402249.09741644026, memory=20.0, io=4.0, network=241971.0], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[=($6, $0)], joinType=[inner], variablesSet=[[$cor7]], variablesSet=[[7]], correlationVariables=[[$cor7]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=123277.0, cpu=402248.09741644026, memory=20.0, io=4.0, network=241943.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1008770331][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=120688.5, cpu=391868.25, memory=19.0, io=3.0, network=241942.0], id = {id} - IgniteMergeJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=120687.5, cpu=391867.25, memory=19.0, io=3.0, network=241918.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 30087.5, cumulative cost = IgniteCost [rowCount=90263.5, cpu=270788.5, memory=1.0, io=1.0, network=240701.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 30087.5, cumulative cost = IgniteCost [rowCount=60176.0, cpu=240701.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=335.5, cpu=724.75, memory=18.0, io=2.0, network=1217.0], id = {id} - IgniteMergeJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[2 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=334.5, cpu=720.75, memory=2.0, io=2.0, network=1217.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=201.0, cpu=201.0, memory=1.0, io=1.0, network=1201.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=101.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 3.75, cumulative cost = IgniteCost [rowCount=29.75, cpu=104.75, memory=1.0, io=1.0, network=16.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'SAUDI ARABIA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 3.75, cumulative cost = IgniteCost [rowCount=26.0, cpu=101.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[AND(=($t1, _UTF-8'F'), =($t0, $cor7.L_ORDERKEY))], rowType=[RecordType(INTEGER O_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 4}], searchBounds=[[null, null, ExactBounds [bound=$cor7.L_ORDERKEY], null, null, null, null, null, null, null, null, null]], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 337.5, cumulative cost = IgniteCost [rowCount=2251.0, cpu=9029.847416440252, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=189551.25, cpu=129386.25, memory=481404.0, io=0.0, network=481400.0], id = {id} - IgniteProject(i=[true]): rowcount = 4513.125, cumulative cost = IgniteCost [rowCount=185038.125, cpu=124873.125, memory=481400.0, io=0.0, network=481400.0], id = {id} - IgniteHashIndexSpool(readType=[LAZY], writeType=[EAGER], searchRow=[[$cor4.L_ORDERKEY, null]], condition=[AND(=($0, $cor4.L_ORDERKEY), <>($1, $cor4.L_SUPPKEY))], allowNulls=[false]): rowcount = 4513.125, cumulative cost = IgniteCost [rowCount=180525.0, cpu=120360.0, memory=481400.0, io=0.0, network=481400.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=120350.0, cpu=120350.0, memory=0.0, io=0.0, network=481400.0], id = {id} - IgniteTableScan(table=[[PUBLIC, LINEITEM]], requiredColumns=[{2, 4}]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=60175.0, cpu=60175.0, memory=0.0, io=0.0, network=0.0], id = {id} - IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=124863.125, cpu=275310.625, memory=240704.0, io=0.0, network=240700.0], id = {id} - IgniteProject(i=[true]): rowcount = 2256.5625, cumulative cost = IgniteCost [rowCount=122606.5625, cpu=273054.0625, memory=240700.0, io=0.0, network=240700.0], id = {id} - IgniteHashIndexSpool(readType=[LAZY], writeType=[EAGER], searchRow=[[$cor0.L_ORDERKEY, null]], condition=[AND(=($0, $cor0.L_ORDERKEY), <>($1, $cor0.L_SUPPKEY))], allowNulls=[false]): rowcount = 2256.5625, cumulative cost = IgniteCost [rowCount=120350.0, cpu=270797.5, memory=240700.0, io=0.0, network=240700.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 30087.5, cumulative cost = IgniteCost [rowCount=90262.5, cpu=270787.5, memory=0.0, io=0.0, network=240700.0], id = {id} - IgniteTableScan(table=[[PUBLIC, LINEITEM]], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}]): rowcount = 30087.5, cumulative cost = IgniteCost [rowCount=60175.0, cpu=240700.0, memory=0.0, io=0.0, network=0.0], id = {id} +IgniteLimit(fetch=[100]): rowcount = 1.9039746093749998, cumulative cost = IgniteCost [rowCount=4897625.177958985, cpu=6504802.287710411, memory=1.0999503199921874E7, io=6.0, network=1.1249801523437498E7], id = {id} + IgniteSort(sort0=[$1], sort1=[$0], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[100]): rowcount = 1.9039746093749998, cumulative cost = IgniteCost [rowCount=4897623.273984375, cpu=6504800.383735801, memory=1.0999503199921874E7, io=6.0, network=1.1249801523437498E7], id = {id} + IgniteColocatedSortAggregate(group=[{0}], NUMWAIT=[COUNT()], collation=[[0 ASC-nulls-first]]): rowcount = 1.9039746093749998, cumulative cost = IgniteCost [rowCount=4897620.370009766, cpu=6504791.767837363, memory=1.0999486968124999E7, io=5.0, network=1.1249800523437498E7], id = {id} + IgniteProject(S_NAME=[$1]): rowcount = 3.8079492187499997, cumulative cost = IgniteCost [rowCount=4897616.562060547, cpu=6504787.959888144, memory=1.0999477968124999E7, io=5.0, network=1.1249800523437498E7], id = {id} + IgniteFilter(condition=[IS NULL($8)]): rowcount = 3.8079492187499997, cumulative cost = IgniteCost [rowCount=4897612.754111328, cpu=6504784.1519389255, memory=1.0999477968124999E7, io=5.0, network=1.1249800523437498E7], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 15.231796874999999, cumulative cost = IgniteCost [rowCount=4897597.5223144535, cpu=6504723.224751426, memory=1.0999477968124999E7, io=5.0, network=1.1249800523437498E7], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[inner], variablesSet=[[$cor4]], variablesSet=[[4]], correlationVariables=[[$cor4]]): rowcount = 15.231796874999999, cumulative cost = IgniteCost [rowCount=2995692.5333398436, cpu=2311186.7800346296, memory=7333123.533124999, io=5.0, network=7583507.015624999], id = {id} + IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 15.231796874999999, cumulative cost = IgniteCost [rowCount=108471.164140625, cpu=340340.77442916104, memory=475.5903125, io=5.0, network=250920.0], id = {id} + IgniteProject(S_SUPPKEY=[$3], S_NAME=[$4], S_NATIONKEY=[$5], L_ORDERKEY=[$1], L_SUPPKEY=[$2], O_ORDERKEY=[$0], N_NATIONKEY=[$6]): rowcount = 15.231796874999999, cumulative cost = IgniteCost [rowCount=108454.93234375, cpu=340200.096484375, memory=48.1, io=4.0, network=250919.0], id = {id} + IgniteMergeJoin(condition=[=($0, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 15.231796874999999, cumulative cost = IgniteCost [rowCount=108439.700546875, cpu=340184.8646875, memory=48.1, io=4.0, network=250919.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 2250.0, cumulative cost = IgniteCost [rowCount=17251.0, cpu=62251.0, memory=1.0, io=1.0, network=9001.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'F')], rowType=[RecordType(INTEGER O_ORDERKEY)], projects=[[$t0]], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 2250.0, cumulative cost = IgniteCost [rowCount=15001.0, cpu=60001.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteHashJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[]]): rowcount = 676.96875, cumulative cost = IgniteCost [rowCount=91173.46875, cpu=277872.9375, memory=47.1, io=3.0, network=241918.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 30087.5, cumulative cost = IgniteCost [rowCount=90263.5, cpu=270788.5, memory=1.0, io=1.0, network=240701.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 30087.5, cumulative cost = IgniteCost [rowCount=60176.0, cpu=240701.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteMergeJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[2 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 2.25, cumulative cost = IgniteCost [rowCount=233.0, cpu=314.75, memory=2.0, io=2.0, network=1217.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=201.0, cpu=201.0, memory=1.0, io=1.0, network=1201.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=101.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 3.75, cumulative cost = IgniteCost [rowCount=29.75, cpu=104.75, memory=1.0, io=1.0, network=16.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'SAUDI ARABIA')], rowType=[RecordType(INTEGER N_NATIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 3.75, cumulative cost = IgniteCost [rowCount=26.0, cpu=101.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=189551.25, cpu=129386.25, memory=481404.0, io=0.0, network=481400.0], id = {id} + IgniteProject(i=[true]): rowcount = 4513.125, cumulative cost = IgniteCost [rowCount=185038.125, cpu=124873.125, memory=481400.0, io=0.0, network=481400.0], id = {id} + IgniteHashIndexSpool(readType=[LAZY], writeType=[EAGER], searchRow=[[$cor4.L_ORDERKEY, null]], condition=[AND(=($0, $cor4.L_ORDERKEY), <>($1, $cor4.L_SUPPKEY))], allowNulls=[false]): rowcount = 4513.125, cumulative cost = IgniteCost [rowCount=180525.0, cpu=120360.0, memory=481400.0, io=0.0, network=481400.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=120350.0, cpu=120350.0, memory=0.0, io=0.0, network=481400.0], id = {id} + IgniteTableScan(table=[[PUBLIC, LINEITEM]], requiredColumns=[{2, 4}]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=60175.0, cpu=60175.0, memory=0.0, io=0.0, network=0.0], id = {id} + IgniteColocatedHashAggregate(group=[{0}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=124863.125, cpu=275310.625, memory=240704.0, io=0.0, network=240700.0], id = {id} + IgniteProject(i=[true]): rowcount = 2256.5625, cumulative cost = IgniteCost [rowCount=122606.5625, cpu=273054.0625, memory=240700.0, io=0.0, network=240700.0], id = {id} + IgniteHashIndexSpool(readType=[LAZY], writeType=[EAGER], searchRow=[[$cor0.L_ORDERKEY, null]], condition=[AND(=($0, $cor0.L_ORDERKEY), <>($1, $cor0.L_SUPPKEY))], allowNulls=[false]): rowcount = 2256.5625, cumulative cost = IgniteCost [rowCount=120350.0, cpu=270797.5, memory=240700.0, io=0.0, network=240700.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 30087.5, cumulative cost = IgniteCost [rowCount=90262.5, cpu=270787.5, memory=0.0, io=0.0, network=240700.0], id = {id} + IgniteTableScan(table=[[PUBLIC, LINEITEM]], filters=[>($t3, $t2)], rowType=[RecordType(INTEGER L_ORDERKEY, INTEGER L_SUPPKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 4, 13, 14}]): rowcount = 30087.5, cumulative cost = IgniteCost [rowCount=60175.0, cpu=240700.0, memory=0.0, io=0.0, network=0.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q22.plan b/modules/calcite/src/test/resources/tpch/q22.plan index 2e21913e05c56..efc9355938f1e 100644 --- a/modules/calcite/src/test/resources/tpch/q22.plan +++ b/modules/calcite/src/test/resources/tpch/q22.plan @@ -1,9 +1,9 @@ -IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 12.738415385219225, cumulative cost = IgniteCost [rowCount=2.523133891147903E7, cpu=1.4423343977370897E7, memory=3.0576924062062718E7, io=509.5671837890626, network=3.0586782206938483E7], id = {id} - IgniteColocatedHashAggregate(group=[{0}], NUMCUST=[COUNT()], TOTACCTBAL=[SUM($1)]): rowcount = 12.738415385219225, cumulative cost = IgniteCost [rowCount=2.5231326173063643E7, cpu=1.4423233995589422E7, memory=3.0576771201078095E7, io=509.5671837890626, network=3.0586782206938483E7], id = {id} - IgniteProject(CNTRYCODE=[SUBSTRING($1, 1, 2)], C_ACCTBAL=[$2]): rowcount = 127.39179594726565, cumulative cost = IgniteCost [rowCount=2.5231198781267695E7, cpu=1.4423106603793474E7, memory=3.05765928632627E7, io=509.5671837890626, network=3.0586782206938483E7], id = {id} - IgniteFilter(condition=[IS NULL($4)]): rowcount = 127.39179594726565, cumulative cost = IgniteCost [rowCount=2.5231071389471747E7, cpu=1.4422979211997526E7, memory=3.05765928632627E7, io=509.5671837890626, network=3.0586782206938483E7], id = {id} - IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 509.5671837890626, cumulative cost = IgniteCost [rowCount=2.5230561822287958E7, cpu=1.442094094326237E7, memory=3.05765928632627E7, io=509.5671837890626, network=3.0586782206938483E7], id = {id} - IgniteNestedLoopJoin(condition=[>($2, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 509.5671837890626, cumulative cost = IgniteCost [rowCount=5967.0903617807635, cpu=18024.49346451514, memory=14.0, io=0.0, network=12241.612410937501], id = {id} +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 12.738415385219225, cumulative cost = IgniteCost [rowCount=2.523083034429524E7, cpu=1.4423344977370897E7, memory=3.0576925062062718E7, io=510.5671837890626, network=3.0586783206938483E7], id = {id} + IgniteColocatedHashAggregate(group=[{0}], NUMCUST=[COUNT()], TOTACCTBAL=[SUM($1)]): rowcount = 12.738415385219225, cumulative cost = IgniteCost [rowCount=2.5230816605879854E7, cpu=1.4423233995589422E7, memory=3.0576771201078095E7, io=509.5671837890626, network=3.0586782206938483E7], id = {id} + IgniteProject(CNTRYCODE=[SUBSTRING($1, 1, 2)], C_ACCTBAL=[$2]): rowcount = 127.39179594726565, cumulative cost = IgniteCost [rowCount=2.5230689214083906E7, cpu=1.4423106603793474E7, memory=3.05765928632627E7, io=509.5671837890626, network=3.0586782206938483E7], id = {id} + IgniteFilter(condition=[IS NULL($4)]): rowcount = 127.39179594726565, cumulative cost = IgniteCost [rowCount=2.5230561822287958E7, cpu=1.4422979211997526E7, memory=3.05765928632627E7, io=509.5671837890626, network=3.0586782206938483E7], id = {id} + IgniteCorrelatedNestedLoopJoin(condition=[true], joinType=[left], variablesSet=[[$cor0]], variablesSet=[[0]], correlationVariables=[[$cor0]]): rowcount = 509.5671837890626, cumulative cost = IgniteCost [rowCount=2.523005225510417E7, cpu=1.442094094326237E7, memory=3.05765928632627E7, io=509.5671837890626, network=3.0586782206938483E7], id = {id} + IgniteNestedLoopJoin(condition=[>($2, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 509.5671837890626, cumulative cost = IgniteCost [rowCount=5457.523177991701, cpu=18024.49346451514, memory=14.0, io=0.0, network=12241.612410937501], id = {id} IgniteExchange(distribution=[single]): rowcount = 1019.1343675781252, cumulative cost = IgniteCost [rowCount=2519.1343675781254, cpu=7019.134367578125, memory=0.0, io=0.0, network=12229.612410937501], id = {id} IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[OR(=(SUBSTRING($t1, 1, 2), _UTF-8'13'), =(SUBSTRING($t1, 1, 2), _UTF-8'17'), =(SUBSTRING($t1, 1, 2), _UTF-8'18'), =(SUBSTRING($t1, 1, 2), _UTF-8'23'), =(SUBSTRING($t1, 1, 2), _UTF-8'29'), =(SUBSTRING($t1, 1, 2), _UTF-8'30'), =(SUBSTRING($t1, 1, 2), _UTF-8'31'))], requiredColumns=[{2, 6, 7}]): rowcount = 1019.1343675781252, cumulative cost = IgniteCost [rowCount=1500.0, cpu=6000.0, memory=0.0, io=0.0, network=0.0], id = {id} IgniteReduceHashAggregate(rowType=[RecordType(DECIMAL(15, 2) EXPR$0)], group=[{}], EXPR$0=[AVG($0)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=2428.821626624513, cpu=6928.821626624514, memory=10.0, io=0.0, network=12.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q3.plan b/modules/calcite/src/test/resources/tpch/q3.plan index d4504ad56e82f..33b3d25685ab3 100644 --- a/modules/calcite/src/test/resources/tpch/q3.plan +++ b/modules/calcite/src/test/resources/tpch/q3.plan @@ -1,14 +1,14 @@ -IgniteLimit(fetch=[10]): rowcount = 4.4296875, cumulative cost = IgniteCost [rowCount=156484.01592786808, cpu=506558.99399080424, memory=824.1796875, io=3.0, network=505660.9420075521], id = {id} - IgniteSort(sort0=[$1], sort1=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[10]): rowcount = 4.4296875, cumulative cost = IgniteCost [rowCount=156479.58624036808, cpu=506554.56430330424, memory=824.1796875, io=3.0, network=505660.9420075521], id = {id} - IgniteProject(L_ORDERKEY=[$0], REVENUE=[$3], O_ORDERDATE=[$1], O_SHIPPRIORITY=[$2]): rowcount = 4.4296875, cumulative cost = IgniteCost [rowCount=156475.15655286808, cpu=506530.3561181737, memory=753.3046875, io=3.0, network=505660.9420075521], id = {id} - IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 4.4296875, cumulative cost = IgniteCost [rowCount=156470.72686536808, cpu=506525.9264306737, memory=753.3046875, io=3.0, network=505660.9420075521], id = {id} - IgniteProject(L_ORDERKEY=[$0], O_ORDERDATE=[$6], O_SHIPPRIORITY=[$7], $f3=[*($1, -(1, $2))]): rowcount = 5.0625, cumulative cost = IgniteCost [rowCount=156465.66436536808, cpu=506520.8639306737, memory=678.0, io=3.0, network=505660.9420075521], id = {id} - IgniteMergeJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]]): rowcount = 5.0625, cumulative cost = IgniteCost [rowCount=156460.60186536808, cpu=506515.8014306737, memory=678.0, io=3.0, network=505660.9420075521], id = {id} - IgniteExchange(distribution=[single]): rowcount = 32340.718228848153, cumulative cost = IgniteCost [rowCount=92516.71822884816, cpu=273041.7182288481, memory=1.0, io=1.0, network=388089.6187461778], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[>($t3, 1995-03-15)], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 12}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 32340.718228848153, cumulative cost = IgniteCost [rowCount=60176.0, cpu=240701.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSort(sort0=[$1], dir0=[ASC-nulls-first]): rowcount = 33.75, cumulative cost = IgniteCost [rowCount=31569.415407671782, cpu=103976.21028643296, memory=677.0, io=2.0, network=117571.32326137427], id = {id} - IgniteMergeJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]]): rowcount = 33.75, cumulative cost = IgniteCost [rowCount=31535.665407671782, cpu=103586.16351917946, memory=2.0, io=2.0, network=117571.32326137427], id = {id} - IgniteExchange(distribution=[single]): rowcount = 225.0, cumulative cost = IgniteCost [rowCount=1726.0, cpu=6226.0, memory=1.0, io=1.0, network=901.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'BUILDING')], rowType=[RecordType(INTEGER C_CUSTKEY)], projects=[[$t0]], requiredColumns=[{2, 8}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 225.0, cumulative cost = IgniteCost [rowCount=1501.0, cpu=6001.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 7291.832703835892, cumulative cost = IgniteCost [rowCount=22292.83270383589, cpu=67292.8327038359, memory=1.0, io=1.0, network=116670.32326137427], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK], filters=[<($t2, 1995-03-15)], requiredColumns=[{2, 3, 6, 9}], inlineScan=[false], collation=[[3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 7291.832703835892, cumulative cost = IgniteCost [rowCount=15001.0, cpu=60001.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteLimit(fetch=[10]): rowcount = 10.0, cumulative cost = IgniteCost [rowCount=83011.47397332314, cpu=213269.2706980442, memory=11006.766237252883, io=3.0, network=505660.9420075521], id = {id} + IgniteSort(sort0=[$1], sort1=[$2], dir0=[DESC-nulls-last], dir1=[ASC-nulls-first], fetch=[10]): rowcount = 10.0, cumulative cost = IgniteCost [rowCount=83001.47397332314, cpu=213259.2706980442, memory=11006.766237252883, io=3.0, network=505660.9420075521], id = {id} + IgniteProject(L_ORDERKEY=[$0], REVENUE=[$3], O_ORDERDATE=[$1], O_SHIPPRIORITY=[$2]): rowcount = 309.51782773623665, cumulative cost = IgniteCost [rowCount=82690.9561455869, cpu=210810.67946182386, memory=10845.766237252883, io=2.0, network=505659.9420075521], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 309.51782773623665, cumulative cost = IgniteCost [rowCount=82381.43831785065, cpu=210501.16163408762, memory=10845.766237252883, io=2.0, network=505659.9420075521], id = {id} + IgniteProject(L_ORDERKEY=[$0], O_ORDERDATE=[$6], O_SHIPPRIORITY=[$7], $f3=[*($1, -(1, $2))]): rowcount = 353.7346602699848, cumulative cost = IgniteCost [rowCount=82027.70365758067, cpu=210147.42697381764, memory=5583.963165736859, io=2.0, network=505659.9420075521], id = {id} + IgniteHashJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[]]): rowcount = 353.7346602699848, cumulative cost = IgniteCost [rowCount=81673.96899731069, cpu=209793.69231354765, memory=5583.963165736859, io=2.0, network=505659.9420075521], id = {id} + IgniteExchange(distribution=[single]): rowcount = 32340.718228848153, cumulative cost = IgniteCost [rowCount=64682.436457696305, cpu=161737.6061810287, memory=1.0, io=1.0, network=388089.6187461778], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[>($t3, 1995-03-15)], rowType=[RecordType(INTEGER L_ORDERKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{2, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1995-03-15, upperBound=null, lowerInclude=false, upperInclude=true], null, null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 32340.718228848153, cumulative cost = IgniteCost [rowCount=32341.718228848153, cpu=129396.88795218056, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteProject(C_CUSTKEY=[$4], O_ORDERKEY=[$0], O_CUSTKEY=[$1], O_ORDERDATE=[$2], O_SHIPPRIORITY=[$3]): rowcount = 164.06623583630758, cumulative cost = IgniteCost [rowCount=16637.7978793444, cpu=44518.7395298191, memory=1711.0, io=1.0, network=117570.32326137427], id = {id} + IgniteHashJoin(condition=[=($4, $1)], joinType=[inner], variablesSet=[[]]): rowcount = 164.06623583630758, cumulative cost = IgniteCost [rowCount=16473.731643508094, cpu=44354.67329398279, memory=1711.0, io=1.0, network=117570.32326137427], id = {id} + IgniteExchange(distribution=[single]): rowcount = 7291.832703835892, cumulative cost = IgniteCost [rowCount=14584.665407671784, cpu=36489.01093561971, memory=1.0, io=1.0, network=116670.32326137427], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[<($t2, 1995-03-15)], requiredColumns=[{2, 3, 6, 9}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=$NULL_BOUND(), upperBound=1995-03-15, lowerInclude=false, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 7291.832703835892, cumulative cost = IgniteCost [rowCount=7292.832703835892, cpu=29197.178231783822, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 225.0, cumulative cost = IgniteCost [rowCount=1725.0, cpu=6225.0, memory=0.0, io=0.0, network=900.0], id = {id} + IgniteTableScan(table=[[PUBLIC, CUSTOMER]], filters=[=($t1, _UTF-8'BUILDING')], rowType=[RecordType(INTEGER C_CUSTKEY)], projects=[[$t0]], requiredColumns=[{2, 8}]): rowcount = 225.0, cumulative cost = IgniteCost [rowCount=1500.0, cpu=6000.0, memory=0.0, io=0.0, network=0.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q5.plan b/modules/calcite/src/test/resources/tpch/q5.plan index f880a5f4e301e..3303ecdfd14e2 100644 --- a/modules/calcite/src/test/resources/tpch/q5.plan +++ b/modules/calcite/src/test/resources/tpch/q5.plan @@ -1,20 +1,20 @@ -IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=210155.49397180113, cpu=455486.23492950277, memory=84.5, io=4.0, network=1013973.9758872044], id = {id} - IgniteColocatedHashAggregate(group=[{0}], REVENUE=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=210154.49397180113, cpu=455482.23492950277, memory=76.5, io=4.0, network=1013973.9758872044], id = {id} - IgniteProject(N_NAME=[$11], $f1=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=210153.49397180113, cpu=455481.23492950277, memory=72.0, io=4.0, network=1013973.9758872044], id = {id} - IgniteNestedLoopJoin(condition=[AND(=($3, $9), =($4, $0))], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=210152.49397180113, cpu=455480.23492950277, memory=72.0, io=4.0, network=1013973.9758872044], id = {id} - IgniteMergeJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 225.0, cumulative cost = IgniteCost [rowCount=29018.493971801116, cpu=92793.23492950278, memory=2.0, io=2.0, network=50067.97588720445], id = {id} - IgniteExchange(distribution=[single]): rowcount = 4758.246985900556, cumulative cost = IgniteCost [rowCount=19759.246985900558, cpu=64759.24698590056, memory=1.0, io=1.0, network=38066.97588720445], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK_proxy], filters=[AND(>=($t2, 1994-01-01), <($t2, 1995-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], inlineScan=[false], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 4758.246985900556, cumulative cost = IgniteCost [rowCount=15001.0, cpu=60001.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=3001.0, cpu=3001.0, memory=1.0, io=1.0, network=12001.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[_key_PK_proxy], requiredColumns=[{2, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=1501.0, cpu=1501.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteNestedLoopJoin(condition=[=($1, $4)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=180909.0, cpu=361787.0, memory=30.0, io=2.0, network=963906.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=120350.0, cpu=120350.0, memory=0.0, io=0.0, network=962800.0], id = {id} - IgniteTableScan(table=[[PUBLIC, LINEITEM]], requiredColumns=[{2, 4, 7, 8}]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=60175.0, cpu=60175.0, memory=0.0, io=0.0, network=0.0], id = {id} - IgniteMergeJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=384.0, cpu=737.0, memory=6.0, io=2.0, network=1106.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=201.0, cpu=161.0, memory=1.0, io=1.0, network=801.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=61.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteNestedLoopJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=82.0, cpu=172.0, memory=5.0, io=1.0, network=305.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=51.0, cpu=51.0, memory=1.0, io=1.0, network=301.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=26.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=21.0, memory=0.0, io=0.0, network=4.0], id = {id} - IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'ASIA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=20.0, memory=0.0, io=0.0, network=0.0], id = {id} +IgniteSort(sort0=[$1], dir0=[DESC-nulls-last]): rowcount = 22.54829159965457, cumulative cost = IgniteCost [rowCount=133396.64257018146, cpu=148660.5172275616, memory=5484.779256220518, io=5.0, network=1013974.9758872044], id = {id} + IgniteColocatedHashAggregate(group=[{0}], REVENUE=[SUM($1)]): rowcount = 22.54829159965457, cumulative cost = IgniteCost [rowCount=133373.0942785818, cpu=148426.210552526, memory=5303.392923423281, io=4.0, network=1013973.9758872044], id = {id} + IgniteProject(N_NAME=[$11], $f1=[*($2, -(1, $3))]): rowcount = 45.09658319930914, cumulative cost = IgniteCost [rowCount=133327.99769538248, cpu=148381.1139693267, memory=5100.45829902639, io=4.0, network=1013973.9758872044], id = {id} + IgniteHashJoin(condition=[AND(=($1, $8), =($0, $4))], joinType=[inner], variablesSet=[[]]): rowcount = 45.09658319930914, cumulative cost = IgniteCost [rowCount=133282.90111218317, cpu=148336.01738612738, memory=5100.45829902639, io=4.0, network=1013973.9758872044], id = {id} + IgniteExchange(distribution=[single]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=120350.0, cpu=120350.0, memory=0.0, io=0.0, network=962800.0], id = {id} + IgniteTableScan(table=[[PUBLIC, LINEITEM]], requiredColumns=[{2, 4, 7, 8}]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=60175.0, cpu=60175.0, memory=0.0, io=0.0, network=0.0], id = {id} + IgniteHashJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[]]): rowcount = 107.06055718276251, cumulative cost = IgniteCost [rowCount=12887.804528983874, cpu=27535.051554134294, memory=47.2, io=4.0, network=51173.97588720445], id = {id} + IgniteExchange(distribution=[single]): rowcount = 4758.246985900556, cumulative cost = IgniteCost [rowCount=9517.493971801112, cpu=23821.082345943032, memory=1.0, io=1.0, network=38066.97588720445], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1994-01-01), <($t2, 1995-01-01))], rowType=[RecordType(INTEGER O_ORDERKEY, INTEGER O_CUSTKEY)], projects=[[$t0, $t1]], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 4758.246985900556, cumulative cost = IgniteCost [rowCount=4759.246985900556, cpu=19062.835360042478, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteMergeJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=3263.25, cpu=2643.3636363636365, memory=10.6, io=3.0, network=13107.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=3001.0, cpu=2387.3636363636365, memory=1.0, io=1.0, network=12001.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=1501.0, cpu=887.3636363636364, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteMergeJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 2.25, cumulative cost = IgniteCost [rowCount=261.25, cpu=252.0, memory=9.6, io=2.0, network=1106.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=201.0, cpu=161.0, memory=1.0, io=1.0, network=801.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=61.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteHashJoin(condition=[=($2, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=58.0, cpu=82.0, memory=8.6, io=1.0, network=305.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=51.0, cpu=51.0, memory=1.0, io=1.0, network=301.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=26.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=21.0, memory=0.0, io=0.0, network=4.0], id = {id} + IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'ASIA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=20.0, memory=0.0, io=0.0, network=0.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q7.plan b/modules/calcite/src/test/resources/tpch/q7.plan index c11eefcae73a2..cdf38bba96053 100644 --- a/modules/calcite/src/test/resources/tpch/q7.plan +++ b/modules/calcite/src/test/resources/tpch/q7.plan @@ -1,23 +1,20 @@ -IgniteSort(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=159447.97603336824, cpu=457039.54322618386, memory=196.475, io=6.0, network=626165.7603336824], id = {id} - IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=159446.97603336824, cpu=457035.54322618386, memory=180.475, io=6.0, network=626165.7603336824], id = {id} - IgniteProject(SUPP_NATION=[$14], CUST_NATION=[$5], L_YEAR=[EXTRACT(FLAG(YEAR), $10)], VOLUME=[*($8, -(1, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=159445.97603336824, cpu=457034.54322618386, memory=165.6, io=6.0, network=626165.7603336824], id = {id} - IgniteFilter(condition=[AND(OR(AND(=($14, _UTF-8'FRANCE'), =($5, _UTF-8'GERMANY')), AND(=($14, _UTF-8'GERMANY'), =($5, _UTF-8'FRANCE'))), SEARCH($5, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), SEARCH($14, Sarg[_UTF-8'FRANCE':VARCHAR CHARACTER SET "UTF-8", _UTF-8'GERMANY':VARCHAR CHARACTER SET "UTF-8"]:VARCHAR CHARACTER SET "UTF-8"), OR(=($5, _UTF-8'GERMANY'), =($5, _UTF-8'FRANCE')), OR(=($14, _UTF-8'FRANCE'), =($14, _UTF-8'GERMANY')))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=159444.97603336824, cpu=457033.54322618386, memory=165.6, io=6.0, network=626165.7603336824], id = {id} - IgniteHashJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=159443.97603336824, cpu=457029.54322618386, memory=165.6, io=6.0, network=626165.7603336824], id = {id} - IgniteMergeJoin(condition=[=($2, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=49585.5, cpu=92322.98338956344, memory=63.0, io=3.0, network=132203.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 15000.0, cumulative cost = IgniteCost [rowCount=30001.0, cpu=23751.0, memory=1.0, io=1.0, network=120001.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_CK_proxy], requiredColumns=[{2, 3}], inlineScan=[true], collation=[[3 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 15000.0, cumulative cost = IgniteCost [rowCount=15001.0, cpu=8751.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 3.75, cumulative cost = IgniteCost [rowCount=4580.75, cpu=8556.983389563437, memory=62.0, io=2.0, network=12202.0], id = {id} - IgniteMergeJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 3.75, cumulative cost = IgniteCost [rowCount=4577.0, cpu=8538.363636363636, memory=2.0, io=2.0, network=12202.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=3001.0, cpu=2387.3636363636365, memory=1.0, io=1.0, network=12001.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=1501.0, cpu=887.3636363636364, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=51.0, cpu=51.0, memory=1.0, io=1.0, network=201.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=26.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteMergeJoin(condition=[=($5, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=109856.47603336824, cpu=364686.5598366204, memory=63.0, io=3.0, network=493962.7603336824], id = {id} - IgniteExchange(distribution=[single]): rowcount = 24647.98801668412, cumulative cost = IgniteCost [rowCount=84823.98801668412, cpu=265348.98801668413, memory=1.0, io=1.0, network=492960.7603336824], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], filters=[AND(>=($t4, 1995-01-01), <=($t4, 1996-12-31))], requiredColumns=[{2, 4, 7, 8, 12}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 24647.98801668412, cumulative cost = IgniteCost [rowCount=60176.0, cpu=240701.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 3.75, cumulative cost = IgniteCost [rowCount=380.75, cpu=730.6197531998012, memory=62.0, io=2.0, network=1002.0], id = {id} - IgniteMergeJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 3.75, cumulative cost = IgniteCost [rowCount=377.0, cpu=712.0, memory=2.0, io=2.0, network=1002.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=201.0, cpu=161.0, memory=1.0, io=1.0, network=801.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=61.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=51.0, cpu=51.0, memory=1.0, io=1.0, network=201.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=26.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteSort(sort0=[$0], sort1=[$1], sort2=[$2], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first], dir2=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=111071.38619053316, cpu=307426.48535399884, memory=18807.690288628426, io=5.0, network=609397.3100037557], id = {id} + IgniteColocatedHashAggregate(group=[{0, 1, 2}], REVENUE=[SUM($3)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=111069.38619053316, cpu=307421.48535399884, memory=18790.690288628426, io=4.0, network=609396.3100037557], id = {id} + IgniteProject(SUPP_NATION=[$1], CUST_NATION=[$14], L_YEAR=[EXTRACT(FLAG(YEAR), $8)], VOLUME=[*($6, -(1, $7))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=111068.38619053316, cpu=307420.48535399884, memory=18775.815288628426, io=4.0, network=609396.3100037557], id = {id} + IgniteHashJoin(condition=[AND(=($3, $0), OR(AND(=($1, _UTF-8'FRANCE'), =($14, _UTF-8'GERMANY')), AND(=($1, _UTF-8'GERMANY'), =($14, _UTF-8'FRANCE'))))], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=111067.38619053316, cpu=307419.48535399884, memory=18775.815288628426, io=4.0, network=609396.3100037557], id = {id} + IgniteExchange(distribution=[single]): rowcount = 6.937500000000002, cumulative cost = IgniteCost [rowCount=31.9375, cpu=106.9375, memory=0.0, io=0.0, network=55.500000000000014], id = {id} + IgniteTableScan(table=[[PUBLIC, NATION]], filters=[OR(=($t1, _UTF-8'FRANCE'), =($t1, _UTF-8'GERMANY'))], requiredColumns=[{2, 3}]): rowcount = 6.937500000000002, cumulative cost = IgniteCost [rowCount=25.0, cpu=100.0, memory=0.0, io=0.0, network=0.0], id = {id} + IgniteHashJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 3.4626571915313593, cumulative cost = IgniteCost [rowCount=111034.44869053316, cpu=307302.54785399884, memory=18583.29154877928, io=4.0, network=609340.8100037557], id = {id} + IgniteExchange(distribution=[single]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=201.0, cpu=161.0, memory=1.0, io=1.0, network=801.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=61.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteHashJoin(condition=[=($8, $9)], joinType=[inner], variablesSet=[[]]): rowcount = 23.084381276875728, cumulative cost = IgniteCost [rowCount=110829.98603334163, cpu=307106.92128208355, memory=17483.475, io=3.0, network=608539.8100037557], id = {id} + IgniteHashJoin(condition=[=($7, $6)], joinType=[inner], variablesSet=[[]]): rowcount = 554.5797303753927, cumulative cost = IgniteCost [rowCount=110774.96415206476, cpu=306769.1399693148, memory=17403.0, io=3.0, network=608484.3100037557], id = {id} + IgniteExchange(distribution=[single]): rowcount = 3697.198202502618, cumulative cost = IgniteCost [rowCount=107219.38442168936, cpu=298835.97902919725, memory=2.0, io=2.0, network=596483.3100037557], id = {id} + IgniteMergeJoin(condition=[=($5, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 3697.198202502618, cumulative cost = IgniteCost [rowCount=103522.18621918674, cpu=295138.7808266946, memory=2.0, io=2.0, network=492961.7603336824], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1008770331][0]]): rowcount = 24647.98801668412, cumulative cost = IgniteCost [rowCount=84823.98801668412, cpu=265348.98801668413, memory=1.0, io=1.0, network=492960.7603336824], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[_key_PK], filters=[AND(>=($t4, 1995-01-01), <=($t4, 1996-12-31))], requiredColumns=[{2, 4, 7, 8, 12}], inlineScan=[false], collation=[[2 ASC-nulls-first, 5 ASC-nulls-first]]): rowcount = 24647.98801668412, cumulative cost = IgniteCost [rowCount=60176.0, cpu=240701.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 15000.0, cumulative cost = IgniteCost [rowCount=15001.0, cpu=15001.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=3001.0, cpu=2387.3636363636365, memory=1.0, io=1.0, network=12001.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=1501.0, cpu=887.3636363636364, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 6.937500000000002, cumulative cost = IgniteCost [rowCount=31.9375, cpu=106.9375, memory=0.0, io=0.0, network=55.500000000000014], id = {id} + IgniteTableScan(table=[[PUBLIC, NATION]], filters=[OR(=($t1, _UTF-8'FRANCE'), =($t1, _UTF-8'GERMANY'))], requiredColumns=[{2, 3}]): rowcount = 6.937500000000002, cumulative cost = IgniteCost [rowCount=25.0, cpu=100.0, memory=0.0, io=0.0, network=0.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q8.plan b/modules/calcite/src/test/resources/tpch/q8.plan index 1589fa2f0b5bf..18effe3708e78 100644 --- a/modules/calcite/src/test/resources/tpch/q8.plan +++ b/modules/calcite/src/test/resources/tpch/q8.plan @@ -1,27 +1,29 @@ -IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=206737.65801486123, cpu=436130.506525959, memory=170.5, io=7.0, network=1292294.632059445], id = {id} - IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=206736.65801486123, cpu=436126.506525959, memory=162.5, io=7.0, network=1292294.632059445], id = {id} - IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=206735.65801486123, cpu=436125.506525959, memory=162.5, io=7.0, network=1292294.632059445], id = {id} - IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($9, _UTF-8'BRAZIL'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=206734.65801486123, cpu=436124.506525959, memory=148.5, io=7.0, network=1292294.632059445], id = {id} - IgniteNestedLoopJoin(condition=[=($0, $10)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=206733.65801486123, cpu=436123.506525959, memory=148.5, io=7.0, network=1292294.632059445], id = {id} - IgniteHashJoin(condition=[=($6, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=183552.75, cpu=371751.5, memory=77.5, io=4.0, network=1205704.0], id = {id} - IgniteMergeJoin(condition=[=($5, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 45.0, cumulative cost = IgniteCost [rowCount=183127.0, cpu=370552.0, memory=2.0, io=2.0, network=1204702.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=120351.0, cpu=120351.0, memory=1.0, io=1.0, network=1203501.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=60176.0, cpu=60176.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 300.0, cumulative cost = IgniteCost [rowCount=2301.0, cpu=8301.0, memory=1.0, io=1.0, network=1201.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 300.0, cumulative cost = IgniteCost [rowCount=2001.0, cpu=8001.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteMergeJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 3.75, cumulative cost = IgniteCost [rowCount=377.0, cpu=712.0, memory=2.0, io=2.0, network=1002.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=201.0, cpu=161.0, memory=1.0, io=1.0, network=801.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=61.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=51.0, cpu=51.0, memory=1.0, io=1.0, network=201.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=26.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=23179.90801486123, cpu=64368.00652595901, memory=39.0, io=3.0, network=86590.63205944492], id = {id} - IgniteExchange(distribution=[single]): rowcount = 6198.636004953743, cumulative cost = IgniteCost [rowCount=12398.272009907487, cpu=31023.02744120897, memory=1.0, io=1.0, network=74384.63205944492], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1995-01-01, upperBound=1996-12-31, lowerInclude=true, upperInclude=true], null, null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 6198.636004953743, cumulative cost = IgniteCost [rowCount=6199.636004953743, cpu=24824.391436255228, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4583.0, cpu=8550.435064935065, memory=18.0, io=2.0, network=12206.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=3001.0, cpu=2387.3636363636365, memory=1.0, io=1.0, network=12001.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=1501.0, cpu=887.3636363636364, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=82.0, cpu=163.07142857142856, memory=5.0, io=1.0, network=205.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=51.0, cpu=42.07142857142857, memory=1.0, io=1.0, network=201.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[N_RK_proxy], requiredColumns=[{2, 4}], inlineScan=[true], collation=[[4 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=17.07142857142857, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=21.0, memory=0.0, io=0.0, network=4.0], id = {id} - IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=20.0, memory=0.0, io=0.0, network=0.0], id = {id} +IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=139004.95005420517, cpu=169452.84384587474, memory=6552.502816762509, io=7.0, network=1292128.4605278631], id = {id} + IgniteReduceSortAggregate(rowType=[RecordType(BIGINT O_YEAR, DECIMAL(32767, 0) $f1, DECIMAL(32767, 0) $f2)], group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=139003.95005420517, cpu=169451.84384587474, memory=6552.502816762509, io=7.0, network=1292128.4605278631], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=139002.95005420517, cpu=169450.84384587474, memory=6552.502816762509, io=7.0, network=1292128.4605278631], id = {id} + IgniteMapSortAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=139001.95005420517, cpu=169449.84384587474, memory=6552.502816762509, io=7.0, network=1292120.4605278631], id = {id} + IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=139000.95005420517, cpu=169448.84384587474, memory=6538.502816762509, io=7.0, network=1292120.4605278631], id = {id} + IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $11)], $f1=[CASE(=($1, _UTF-8'BRAZIL'), *($7, -(1, $8)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($7, -(1, $8))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=138999.95005420517, cpu=169444.84384587474, memory=6526.502816762509, io=7.0, network=1292120.4605278631], id = {id} + IgniteMergeJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=138998.95005420517, cpu=169443.84384587474, memory=6526.502816762509, io=7.0, network=1292120.4605278631], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=26.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1052618937][1]]): rowcount = 1.888327290590338, cumulative cost = IgniteCost [rowCount=138971.95005420517, cpu=169413.84384587474, memory=6525.502816762509, io=6.0, network=1292119.4605278631], id = {id} + IgniteHashJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[]]): rowcount = 1.888327290590338, cumulative cost = IgniteCost [rowCount=138970.06172691457, cpu=169411.95551858415, memory=6525.502816762509, io=6.0, network=1291998.6075812653], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=61.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1663305268][2]]): rowcount = 12.588848603935588, cumulative cost = IgniteCost [rowCount=138867.17339962398, cpu=169332.07224567825, memory=5774.207439967948, io=5.0, network=1291997.6075812653], id = {id} + IgniteMergeJoin(condition=[=($13, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 12.588848603935588, cumulative cost = IgniteCost [rowCount=138854.58455102003, cpu=169319.4833970743, memory=5774.207439967948, io=5.0, network=1291292.632059445], id = {id} + IgniteHashJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[]]): rowcount = 559.5043823971373, cumulative cost = IgniteCost [rowCount=136540.99570241608, cpu=160968.12800265857, memory=5773.207439967948, io=4.0, network=1290091.632059445], id = {id} + IgniteExchange(distribution=[single]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=120351.0, cpu=120351.0, memory=1.0, io=1.0, network=1203501.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=60176.0, cpu=60176.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteHashJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 139.4693101114592, cumulative cost = IgniteCost [rowCount=15630.491320018946, cpu=35022.084178687204, memory=807.1, io=3.0, network=86590.63205944492], id = {id} + IgniteExchange(distribution=[single]): rowcount = 6198.636004953743, cumulative cost = IgniteCost [rowCount=12398.272009907487, cpu=31023.02744120897, memory=1.0, io=1.0, network=74384.63205944492], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1995-01-01, upperBound=1996-12-31, lowerInclude=true, upperInclude=true], null, null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 6198.636004953743, cumulative cost = IgniteCost [rowCount=6199.636004953743, cpu=24824.391436255228, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteMergeJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 33.75, cumulative cost = IgniteCost [rowCount=3092.75, cpu=2604.3636363636365, memory=9.6, io=2.0, network=12206.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=3001.0, cpu=2387.3636363636365, memory=1.0, io=1.0, network=12001.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=1501.0, cpu=887.3636363636364, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteHashJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=58.0, cpu=82.0, memory=8.6, io=1.0, network=205.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=51.0, cpu=51.0, memory=1.0, io=1.0, network=201.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=26.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=21.0, memory=0.0, io=0.0, network=4.0], id = {id} + IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=20.0, memory=0.0, io=0.0, network=0.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 300.0, cumulative cost = IgniteCost [rowCount=2301.0, cpu=8301.0, memory=1.0, io=1.0, network=1201.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 300.0, cumulative cost = IgniteCost [rowCount=2001.0, cpu=8001.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/q9.plan b/modules/calcite/src/test/resources/tpch/q9.plan index a66d83e26b934..198c4a8943e36 100644 --- a/modules/calcite/src/test/resources/tpch/q9.plan +++ b/modules/calcite/src/test/resources/tpch/q9.plan @@ -1,24 +1,22 @@ -IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=237424.5, cpu=494828.6197531998, memory=183.75, io=6.0, network=1541314.0], id = {id} - IgniteColocatedHashAggregate(group=[{0, 1}], SUM_PROFIT=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=237423.5, cpu=494824.6197531998, memory=171.75, io=6.0, network=1541314.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=237422.5, cpu=494823.6197531998, memory=162.0, io=6.0, network=1541314.0], id = {id} - IgniteProject(NATION=[$9], O_YEAR=[EXTRACT(FLAG(YEAR), $15)], AMOUNT=[-(*($4, -(1, $5)), *($13, $3))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=237421.5, cpu=494822.6197531998, memory=162.0, io=6.0, network=1541302.0], id = {id} - IgniteMergeJoin(condition=[=($14, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=237420.5, cpu=494821.6197531998, memory=162.0, io=6.0, network=1541302.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1008770331][0]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=207418.5, cpu=419816.6197531998, memory=161.0, io=5.0, network=1541301.0], id = {id} - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=207417.5, cpu=419815.6197531998, memory=161.0, io=5.0, network=1541245.0], id = {id} - IgniteMergeJoin(condition=[AND(=($12, $2), =($11, $1))], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 2 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first, 1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=207416.5, cpu=419811.6197531998, memory=105.0, io=5.0, network=1541245.0], id = {id} - IgniteMergeJoin(condition=[=($10, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 2 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=183414.5, cpu=371806.6197531998, memory=104.0, io=4.0, network=1445244.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=3433459][1]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=180912.5, cpu=361801.6197531998, memory=103.0, io=3.0, network=1445243.0], id = {id} - IgniteSort(sort0=[$1], sort1=[$2], dir0=[ASC-nulls-first], dir1=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=180911.5, cpu=361800.6197531998, memory=103.0, io=3.0, network=1445203.0], id = {id} - IgniteMergeJoin(condition=[=($6, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[2 ASC-nulls-first, 1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=180910.5, cpu=361796.6197531998, memory=63.0, io=3.0, network=1445203.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=120351.0, cpu=120351.0, memory=1.0, io=1.0, network=1444201.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SK_PK], requiredColumns=[{2, 3, 4, 6, 7, 8}], inlineScan=[false], collation=[[4 ASC-nulls-first, 3 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=60176.0, cpu=60176.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 3.75, cumulative cost = IgniteCost [rowCount=380.75, cpu=730.6197531998012, memory=62.0, io=2.0, network=1002.0], id = {id} - IgniteMergeJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 3.75, cumulative cost = IgniteCost [rowCount=377.0, cpu=712.0, memory=2.0, io=2.0, network=1002.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=201.0, cpu=161.0, memory=1.0, io=1.0, network=801.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=61.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=51.0, cpu=51.0, memory=1.0, io=1.0, network=201.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=26.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[LIKE($t1, _UTF-8'%green%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 500.0, cumulative cost = IgniteCost [rowCount=2001.0, cpu=8001.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=3433459][0]]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=16001.0, cpu=16001.0, memory=1.0, io=1.0, network=96001.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=8001.0, cpu=8001.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteColocatedSortAggregate(group=[{0, 1}], SUM_PROFIT=[SUM($2)], collation=[[0 ASC-nulls-first, 1 DESC-nulls-last]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=155527.75320898433, cpu=165783.28107226564, memory=2309.661359375, io=7.0, network=1543282.973546875], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=155526.75320898433, cpu=165782.28107226564, memory=2296.661359375, io=7.0, network=1543282.973546875], id = {id} + IgniteSort(sort0=[$0], sort1=[$1], dir0=[ASC-nulls-first], dir1=[DESC-nulls-last]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=155525.75320898433, cpu=165781.28107226564, memory=2296.661359375, io=7.0, network=1543270.973546875], id = {id} + IgniteProject(NATION=[$3], O_YEAR=[EXTRACT(FLAG(YEAR), $1)], AMOUNT=[-(*($10, -(1, $11)), *($14, $9))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=155524.75320898433, cpu=165777.28107226564, memory=2284.661359375, io=7.0, network=1543270.973546875], id = {id} + IgniteMergeJoin(condition=[=($0, $6)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[4 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=155523.75320898433, cpu=165776.28107226564, memory=2284.661359375, io=7.0, network=1543270.973546875], id = {id} IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 15000.0, cumulative cost = IgniteCost [rowCount=15001.0, cpu=15001.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1008770331][4]]): rowcount = 1.142384765625, cumulative cost = IgniteCost [rowCount=140521.75320898433, cpu=150771.28107226564, memory=2283.661359375, io=6.0, network=1543269.973546875], id = {id} + IgniteSort(sort0=[$4], dir0=[ASC-nulls-first]): rowcount = 1.142384765625, cumulative cost = IgniteCost [rowCount=140520.61082421872, cpu=150770.13868750003, memory=2283.661359375, io=6.0, network=1543206.0], id = {id} + IgniteMergeJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]]): rowcount = 1.142384765625, cumulative cost = IgniteCost [rowCount=140518.4684394531, cpu=150764.56914843753, memory=2218.6878125, io=5.0, network=1543205.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=51.0, cpu=51.0, memory=1.0, io=1.0, network=201.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=26.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteHashJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[]]): rowcount = 7.615898437499999, cumulative cost = IgniteCost [rowCount=140466.3260546875, cpu=150708.99960937502, memory=2217.6878125, io=4.0, network=1543004.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=201.0, cpu=161.0, memory=1.0, io=1.0, network=801.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=61.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteMergeJoin(condition=[=($9, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 50.77265625, cumulative cost = IgniteCost [rowCount=140257.71015625, cpu=150471.840625, memory=3.0, io=3.0, network=1542203.0], id = {id} + IgniteMergeJoin(condition=[AND(=($7, $2), =($6, $1))], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 2 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first, 1 ASC-nulls-first]]): rowcount = 1353.9375, cumulative cost = IgniteCost [rowCount=137705.9375, cpu=141767.75, memory=2.0, io=2.0, network=1540202.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=120351.0, cpu=120351.0, memory=1.0, io=1.0, network=1444201.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{2, 3, 4, 6, 7, 8}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=60176.0, cpu=60176.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=16001.0, cpu=16001.0, memory=1.0, io=1.0, network=96001.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PARTSUPP]], index=[PS_PK], requiredColumns=[{2, 3, 5}], inlineScan=[false], collation=[[2 ASC-nulls-first, 3 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 8000.0, cumulative cost = IgniteCost [rowCount=8001.0, cpu=8001.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 500.0, cumulative cost = IgniteCost [rowCount=2501.0, cpu=8501.0, memory=1.0, io=1.0, network=2001.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[LIKE($t1, _UTF-8'%green%')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 500.0, cumulative cost = IgniteCost [rowCount=2001.0, cpu=8001.0, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/variant_q12.plan b/modules/calcite/src/test/resources/tpch/variant_q12.plan index 8918e8d3750c0..78b9372929de8 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q12.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q12.plan @@ -1,10 +1,9 @@ -IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 95.89777154549579, cumulative cost = IgniteCost [rowCount=52939.998202313174, cpu=185854.5386578313, memory=12734.43769170244, io=2.0, network=11381.8688900655], id = {id} - IgniteReduceHashAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)]): rowcount = 95.89777154549579, cumulative cost = IgniteCost [rowCount=52844.10043076768, cpu=184445.81494794137, memory=11583.664433156491, io=2.0, network=11381.8688900655], id = {id} - IgniteExchange(distribution=[single]): rowcount = 95.89777154549579, cumulative cost = IgniteCost [rowCount=52748.20265922218, cpu=184349.9171763959, memory=11573.664433156491, io=2.0, network=11381.8688900655], id = {id} - IgniteMapHashAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)]): rowcount = 95.89777154549579, cumulative cost = IgniteCost [rowCount=52652.304887676684, cpu=184254.0194048504, memory=11573.664433156491, io=2.0, network=10231.09563151955], id = {id} - IgniteProject(L_SHIPMODE=[$1], $f1=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($3, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 0, 1)]): rowcount = 191.79554309099157, cumulative cost = IgniteCost [rowCount=52460.50934458569, cpu=184062.2238617594, memory=10231.09563151955, io=2.0, network=10231.09563151955], id = {id} - IgniteMergeJoin(condition=[=($2, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 191.79554309099157, cumulative cost = IgniteCost [rowCount=52268.7138014947, cpu=183870.42831866842, memory=10231.09563151955, io=2.0, network=10231.09563151955], id = {id} - IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1008770331][0]]): rowcount = 1278.6369539399439, cumulative cost = IgniteCost [rowCount=20989.076847554752, cpu=103754.88050290864, memory=10230.09563151955, io=1.0, network=10230.09563151955], id = {id} - IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1278.6369539399439, cumulative cost = IgniteCost [rowCount=19710.439893614806, cpu=102476.24354896869, memory=10230.09563151955, io=1.0, network=1.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1278.6369539399439, cumulative cost = IgniteCost [rowCount=18431.80293967486, cpu=73757.2267954874, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[_key_PK_proxy], requiredColumns=[{2, 7}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 15000.0, cumulative cost = IgniteCost [rowCount=15001.0, cpu=15001.0, memory=1.0, io=1.0, network=1.0], id = {id} +IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 95.89777154549579, cumulative cost = IgniteCost [rowCount=35574.519837524276, cpu=93938.92951950018, memory=17337.53072588624, io=2.0, network=11381.8688900655], id = {id} + IgniteReduceHashAggregate(rowType=[RecordType(VARCHAR L_SHIPMODE, BIGINT HIGH_LINE_COUNT, BIGINT LOW_LINE_COUNT)], group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)]): rowcount = 95.89777154549579, cumulative cost = IgniteCost [rowCount=35477.62206597878, cpu=92529.20580961024, memory=16185.75746734029, io=1.0, network=11380.8688900655], id = {id} + IgniteExchange(distribution=[single]): rowcount = 95.89777154549579, cumulative cost = IgniteCost [rowCount=35381.72429443328, cpu=92433.30803806474, memory=16175.75746734029, io=1.0, network=11380.8688900655], id = {id} + IgniteMapHashAggregate(group=[{0}], HIGH_LINE_COUNT=[SUM($1)], LOW_LINE_COUNT=[SUM($2)]): rowcount = 95.89777154549579, cumulative cost = IgniteCost [rowCount=35285.826522887786, cpu=92337.41026651925, memory=16175.75746734029, io=1.0, network=10230.09563151955], id = {id} + IgniteProject(L_SHIPMODE=[$3], $f1=[CASE(SEARCH($1, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 1, 0)], $f2=[CASE(SEARCH($1, Sarg[_UTF-8'1-URGENT':VARCHAR(8) CHARACTER SET "UTF-8", _UTF-8'2-HIGH':VARCHAR(8) CHARACTER SET "UTF-8"]:VARCHAR(8) CHARACTER SET "UTF-8"), 0, 1)]): rowcount = 191.79554309099157, cumulative cost = IgniteCost [rowCount=35094.03097979679, cpu=92145.61472342825, memory=14833.18866570335, io=1.0, network=10230.09563151955], id = {id} + IgniteHashJoin(condition=[=($0, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 191.79554309099157, cumulative cost = IgniteCost [rowCount=34902.2354367058, cpu=91953.81918033726, memory=14833.18866570335, io=1.0, network=10230.09563151955], id = {id} + IgniteTableScan(table=[[PUBLIC, ORDERS]], requiredColumns=[{2, 7}]): rowcount = 15000.0, cumulative cost = IgniteCost [rowCount=15000.0, cpu=15000.0, memory=0.0, io=0.0, network=0.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1008770331][0]]): rowcount = 1278.6369539399439, cumulative cost = IgniteCost [rowCount=19710.439893614806, cpu=75035.86374942734, memory=1.0, io=1.0, network=10230.09563151955], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_RD], filters=[AND(OR(=($t4, _UTF-8'MAIL'), =($t4, _UTF-8'SHIP')), <($t2, $t3), <($t1, $t2), AND(>=($t3, 1994-01-01), <($t3, 1995-01-01)))], rowType=[RecordType(INTEGER L_ORDERKEY, VARCHAR L_SHIPMODE)], projects=[[$t0, $t4]], requiredColumns=[{2, 12, 13, 14, 16}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1994-01-01, upperBound=1995-01-01, lowerInclude=true, upperInclude=false], null, null, null, null]], inlineScan=[false], collation=[[14 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 1278.6369539399439, cumulative cost = IgniteCost [rowCount=18431.80293967486, cpu=73757.2267954874, memory=1.0, io=1.0, network=1.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/variant_q14.plan b/modules/calcite/src/test/resources/tpch/variant_q14.plan index 0fcd993024ca5..3fcd29536de29 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q14.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q14.plan @@ -1,7 +1,7 @@ -IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=52580.60043502075, cpu=254528.01721189165, memory=23211.0, io=1.0, network=199915.401740083], id = {id} - IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=52579.60043502075, cpu=254527.01721189165, memory=23211.0, io=1.0, network=199915.401740083], id = {id} - IgniteProject($f0=[CASE(=(SUBSTRING($4, 1, 5), _UTF-8'PROMO'), *($1, -(1, $2)), 0.0000:DECIMAL(31, 4))], $f1=[*($1, -(1, $2))]): rowcount = 300.0, cumulative cost = IgniteCost [rowCount=52279.60043502075, cpu=254227.01721189165, memory=23201.0, io=1.0, network=199915.401740083], id = {id} - IgniteHashJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 300.0, cumulative cost = IgniteCost [rowCount=51979.60043502075, cpu=253927.01721189165, memory=23201.0, io=1.0, network=199915.401740083], id = {id} +IgniteProject(PROMO_REVENUE=[/(*(100.00:DECIMAL(5, 2), $0), $1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=41551.19035526695, cpu=108253.17602283497, memory=23211.0, io=1.0, network=199915.401740083], id = {id} + IgniteColocatedHashAggregate(group=[{}], agg#0=[SUM($0)], agg#1=[SUM($1)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=41550.19035526695, cpu=108252.17602283497, memory=23211.0, io=1.0, network=199915.401740083], id = {id} + IgniteProject($f0=[CASE(=(SUBSTRING($4, 1, 5), _UTF-8'PROMO'), *($1, -(1, $2)), 0.0000:DECIMAL(31, 4))], $f1=[*($1, -(1, $2))]): rowcount = 2298.930021751037, cumulative cost = IgniteCost [rowCount=39251.26033351591, cpu=105953.24600108394, memory=23201.0, io=1.0, network=199915.401740083], id = {id} + IgniteHashJoin(condition=[=($0, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 2298.930021751037, cumulative cost = IgniteCost [rowCount=36952.33031176487, cpu=103654.31597933291, memory=23201.0, io=1.0, network=199915.401740083], id = {id} IgniteExchange(distribution=[single]): rowcount = 15326.200145006917, cumulative cost = IgniteCost [rowCount=30653.400290013833, cpu=76665.01576182253, memory=1.0, io=1.0, network=183915.401740083], id = {id} IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_SD], filters=[AND(>=($t3, 1995-09-01), <($t3, 1995-10-01))], rowType=[RecordType(INTEGER L_PARTKEY, DECIMAL(15, 2) L_EXTENDEDPRICE, DECIMAL(15, 2) L_DISCOUNT)], projects=[[$t0, $t1, $t2]], requiredColumns=[{3, 7, 8, 12}], searchBounds=[[null, null, null, null, null, null, null, null, null, null, null, null, RangeBounds [lowerBound=1995-09-01, upperBound=1995-10-01, lowerInclude=true, upperInclude=false], null, null, null, null, null, null]], inlineScan=[false], collation=[[12 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 15326.200145006917, cumulative cost = IgniteCost [rowCount=15327.200145006917, cpu=61338.81561681562, memory=1.0, io=1.0, network=1.0], id = {id} IgniteExchange(distribution=[single]): rowcount = 2000.0, cumulative cost = IgniteCost [rowCount=4000.0, cpu=4000.0, memory=0.0, io=0.0, network=16000.0], id = {id} diff --git a/modules/calcite/src/test/resources/tpch/variant_q8.plan b/modules/calcite/src/test/resources/tpch/variant_q8.plan index 1589fa2f0b5bf..18effe3708e78 100644 --- a/modules/calcite/src/test/resources/tpch/variant_q8.plan +++ b/modules/calcite/src/test/resources/tpch/variant_q8.plan @@ -1,27 +1,29 @@ -IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=206737.65801486123, cpu=436130.506525959, memory=170.5, io=7.0, network=1292294.632059445], id = {id} - IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=206736.65801486123, cpu=436126.506525959, memory=162.5, io=7.0, network=1292294.632059445], id = {id} - IgniteColocatedHashAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=206735.65801486123, cpu=436125.506525959, memory=162.5, io=7.0, network=1292294.632059445], id = {id} - IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $12)], $f1=[CASE(=($9, _UTF-8'BRAZIL'), *($3, -(1, $4)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($3, -(1, $4))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=206734.65801486123, cpu=436124.506525959, memory=148.5, io=7.0, network=1292294.632059445], id = {id} - IgniteNestedLoopJoin(condition=[=($0, $10)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=206733.65801486123, cpu=436123.506525959, memory=148.5, io=7.0, network=1292294.632059445], id = {id} - IgniteHashJoin(condition=[=($6, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=183552.75, cpu=371751.5, memory=77.5, io=4.0, network=1205704.0], id = {id} - IgniteMergeJoin(condition=[=($5, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 45.0, cumulative cost = IgniteCost [rowCount=183127.0, cpu=370552.0, memory=2.0, io=2.0, network=1204702.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=120351.0, cpu=120351.0, memory=1.0, io=1.0, network=1203501.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=60176.0, cpu=60176.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 300.0, cumulative cost = IgniteCost [rowCount=2301.0, cpu=8301.0, memory=1.0, io=1.0, network=1201.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 300.0, cumulative cost = IgniteCost [rowCount=2001.0, cpu=8001.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteMergeJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 3.75, cumulative cost = IgniteCost [rowCount=377.0, cpu=712.0, memory=2.0, io=2.0, network=1002.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=201.0, cpu=161.0, memory=1.0, io=1.0, network=801.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=61.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=51.0, cpu=51.0, memory=1.0, io=1.0, network=201.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=26.0, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteNestedLoopJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=23179.90801486123, cpu=64368.00652595901, memory=39.0, io=3.0, network=86590.63205944492], id = {id} - IgniteExchange(distribution=[single]): rowcount = 6198.636004953743, cumulative cost = IgniteCost [rowCount=12398.272009907487, cpu=31023.02744120897, memory=1.0, io=1.0, network=74384.63205944492], id = {id} - IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1995-01-01, upperBound=1996-12-31, lowerInclude=true, upperInclude=true], null, null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 6198.636004953743, cumulative cost = IgniteCost [rowCount=6199.636004953743, cpu=24824.391436255228, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=4583.0, cpu=8550.435064935065, memory=18.0, io=2.0, network=12206.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=3001.0, cpu=2387.3636363636365, memory=1.0, io=1.0, network=12001.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=1501.0, cpu=887.3636363636364, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteNestedLoopJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=82.0, cpu=163.07142857142856, memory=5.0, io=1.0, network=205.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=51.0, cpu=42.07142857142857, memory=1.0, io=1.0, network=201.0], id = {id} - IgniteIndexScan(table=[[PUBLIC, NATION]], index=[N_RK_proxy], requiredColumns=[{2, 4}], inlineScan=[true], collation=[[4 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=17.07142857142857, memory=1.0, io=1.0, network=1.0], id = {id} - IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=21.0, memory=0.0, io=0.0, network=4.0], id = {id} - IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=20.0, memory=0.0, io=0.0, network=0.0], id = {id} +IgniteProject(O_YEAR=[$0], MKT_SHARE=[/($1, $2)]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=139004.95005420517, cpu=169452.84384587474, memory=6552.502816762509, io=7.0, network=1292128.4605278631], id = {id} + IgniteReduceSortAggregate(rowType=[RecordType(BIGINT O_YEAR, DECIMAL(32767, 0) $f1, DECIMAL(32767, 0) $f2)], group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=139003.95005420517, cpu=169451.84384587474, memory=6552.502816762509, io=7.0, network=1292128.4605278631], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=139002.95005420517, cpu=169450.84384587474, memory=6552.502816762509, io=7.0, network=1292128.4605278631], id = {id} + IgniteMapSortAggregate(group=[{0}], agg#0=[SUM($1)], agg#1=[SUM($2)], collation=[[0 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=139001.95005420517, cpu=169449.84384587474, memory=6552.502816762509, io=7.0, network=1292120.4605278631], id = {id} + IgniteSort(sort0=[$0], dir0=[ASC-nulls-first]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=139000.95005420517, cpu=169448.84384587474, memory=6538.502816762509, io=7.0, network=1292120.4605278631], id = {id} + IgniteProject(O_YEAR=[EXTRACT(FLAG(YEAR), $11)], $f1=[CASE(=($1, _UTF-8'BRAZIL'), *($7, -(1, $8)), 0.0000:DECIMAL(31, 4))], VOLUME=[*($7, -(1, $8))]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=138999.95005420517, cpu=169444.84384587474, memory=6526.502816762509, io=7.0, network=1292120.4605278631], id = {id} + IgniteMergeJoin(condition=[=($3, $0)], joinType=[inner], variablesSet=[[]], leftCollation=[[0 ASC-nulls-first]], rightCollation=[[1 ASC-nulls-first]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=138998.95005420517, cpu=169443.84384587474, memory=6526.502816762509, io=7.0, network=1292120.4605278631], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 3}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=26.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1052618937][1]]): rowcount = 1.888327290590338, cumulative cost = IgniteCost [rowCount=138971.95005420517, cpu=169413.84384587474, memory=6525.502816762509, io=6.0, network=1292119.4605278631], id = {id} + IgniteHashJoin(condition=[=($0, $4)], joinType=[inner], variablesSet=[[]]): rowcount = 1.888327290590338, cumulative cost = IgniteCost [rowCount=138970.06172691457, cpu=169411.95551858415, memory=6525.502816762509, io=6.0, network=1291998.6075812653], id = {id} + IgniteIndexScan(table=[[PUBLIC, SUPPLIER]], index=[S_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 100.0, cumulative cost = IgniteCost [rowCount=101.0, cpu=61.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[affinity[identity=AffinityIdentity [affFuncCls=class org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction, backups=0, partsCnt=1024, filterCls=class org.apache.ignite.configuration.CacheConfiguration$IgniteAllNodesPredicate, hash={hash}, cacheId=-1663305268][2]]): rowcount = 12.588848603935588, cumulative cost = IgniteCost [rowCount=138867.17339962398, cpu=169332.07224567825, memory=5774.207439967948, io=5.0, network=1291997.6075812653], id = {id} + IgniteMergeJoin(condition=[=($13, $1)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 12.588848603935588, cumulative cost = IgniteCost [rowCount=138854.58455102003, cpu=169319.4833970743, memory=5774.207439967948, io=5.0, network=1291292.632059445], id = {id} + IgniteHashJoin(condition=[=($0, $5)], joinType=[inner], variablesSet=[[]]): rowcount = 559.5043823971373, cumulative cost = IgniteCost [rowCount=136540.99570241608, cpu=160968.12800265857, memory=5773.207439967948, io=4.0, network=1290091.632059445], id = {id} + IgniteExchange(distribution=[single]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=120351.0, cpu=120351.0, memory=1.0, io=1.0, network=1203501.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, LINEITEM]], index=[L_PK_SK], requiredColumns=[{2, 3, 4, 7, 8}], inlineScan=[false], collation=[[3 ASC-nulls-first, 4 ASC-nulls-first, 2 ASC-nulls-first, 5 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 60175.0, cumulative cost = IgniteCost [rowCount=60176.0, cpu=60176.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteHashJoin(condition=[=($1, $3)], joinType=[inner], variablesSet=[[]]): rowcount = 139.4693101114592, cumulative cost = IgniteCost [rowCount=15630.491320018946, cpu=35022.084178687204, memory=807.1, io=3.0, network=86590.63205944492], id = {id} + IgniteExchange(distribution=[single]): rowcount = 6198.636004953743, cumulative cost = IgniteCost [rowCount=12398.272009907487, cpu=31023.02744120897, memory=1.0, io=1.0, network=74384.63205944492], id = {id} + IgniteIndexScan(table=[[PUBLIC, ORDERS]], index=[O_OD], filters=[AND(>=($t2, 1995-01-01), <=($t2, 1996-12-31))], requiredColumns=[{2, 3, 6}], searchBounds=[[null, null, null, null, null, null, RangeBounds [lowerBound=1995-01-01, upperBound=1996-12-31, lowerInclude=true, upperInclude=true], null, null, null, null, null]], inlineScan=[false], collation=[[6 ASC-nulls-first, 0 ASC-nulls-first]]): rowcount = 6198.636004953743, cumulative cost = IgniteCost [rowCount=6199.636004953743, cpu=24824.391436255228, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteMergeJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]], leftCollation=[[1 ASC-nulls-first, 0 ASC-nulls-first]], rightCollation=[[0 ASC-nulls-first]]): rowcount = 33.75, cumulative cost = IgniteCost [rowCount=3092.75, cpu=2604.3636363636365, memory=9.6, io=2.0, network=12206.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=3001.0, cpu=2387.3636363636365, memory=1.0, io=1.0, network=12001.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, CUSTOMER]], index=[C_NK_proxy], requiredColumns=[{2, 5}], inlineScan=[true], collation=[[5 ASC-nulls-first, 2 ASC-nulls-first]]): rowcount = 1500.0, cumulative cost = IgniteCost [rowCount=1501.0, cpu=887.3636363636364, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteHashJoin(condition=[=($1, $2)], joinType=[inner], variablesSet=[[]]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=58.0, cpu=82.0, memory=8.6, io=1.0, network=205.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=51.0, cpu=51.0, memory=1.0, io=1.0, network=201.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, NATION]], index=[_key_PK_proxy], requiredColumns=[{2, 4}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 25.0, cumulative cost = IgniteCost [rowCount=26.0, cpu=26.0, memory=1.0, io=1.0, network=1.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=6.0, cpu=21.0, memory=0.0, io=0.0, network=4.0], id = {id} + IgniteTableScan(table=[[PUBLIC, REGION]], filters=[=($t1, _UTF-8'AMERICA')], rowType=[RecordType(INTEGER R_REGIONKEY)], projects=[[$t0]], requiredColumns=[{2, 3}]): rowcount = 1.0, cumulative cost = IgniteCost [rowCount=5.0, cpu=20.0, memory=0.0, io=0.0, network=0.0], id = {id} + IgniteExchange(distribution=[single]): rowcount = 300.0, cumulative cost = IgniteCost [rowCount=2301.0, cpu=8301.0, memory=1.0, io=1.0, network=1201.0], id = {id} + IgniteIndexScan(table=[[PUBLIC, PART]], index=[_key_PK_proxy], filters=[=($t1, _UTF-8'ECONOMY ANODIZED STEEL')], rowType=[RecordType(INTEGER P_PARTKEY)], projects=[[$t0]], requiredColumns=[{2, 6}], inlineScan=[false], collation=[[2 ASC-nulls-first]]): rowcount = 300.0, cumulative cost = IgniteCost [rowCount=2001.0, cpu=8001.0, memory=1.0, io=1.0, network=1.0], id = {id}