diff --git a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/metadata/expressions/FieldKeyExpression.java b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/metadata/expressions/FieldKeyExpression.java index a89828ca234..6818ab24cc5 100644 --- a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/metadata/expressions/FieldKeyExpression.java +++ b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/metadata/expressions/FieldKeyExpression.java @@ -33,6 +33,7 @@ import com.apple.foundationdb.record.query.plan.cascades.KeyExpressionVisitor; import com.apple.foundationdb.record.query.plan.cascades.Quantifier; import com.apple.foundationdb.record.query.plan.cascades.expressions.ExplodeExpression; +import com.apple.foundationdb.record.query.plan.cascades.values.Value; import com.apple.foundationdb.record.util.ProtoUtils; import com.google.common.collect.ImmutableList; import com.google.protobuf.Descriptors; @@ -274,19 +275,25 @@ public R expand(@Nonnull final KeyExpr return visitor.visitExpression(this); } + /** + * Creates a quantifier that unnests this field of {@code baseValue}. + * + * @param baseValue the value this field is a field of + * @param fieldNamePrefix the nesting chain of non-repeated fields leading to this field + * + * @return a quantifier ranging over an {@link ExplodeExpression} of this field + */ @Nonnull - public Quantifier.ForEach explodeField(@Nonnull Quantifier.ForEach baseQuantifier, @Nonnull List fieldNamePrefix) { + public Quantifier.ForEach explodeField(@Nonnull Value baseValue, @Nonnull List fieldNamePrefix) { final List fieldNames = ImmutableList.builder() .addAll(fieldNamePrefix) .add(ProtoUtils.toUserIdentifier(fieldName)) .build(); - switch (fanType) { - case FanOut: - return Quantifier.forEach(Reference.initialOf( - ExplodeExpression.explodeField(baseQuantifier, fieldNames))); - default: - throw new RecordCoreException("unrecognized fan type"); + if (fanType == FanType.FanOut) { + return Quantifier.forEach(Reference.initialOf( + ExplodeExpression.explodeField(baseValue, fieldNames))); } + throw new RecordCoreException("unrecognized fan type"); } @Nonnull diff --git a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/KeyExpressionExpansionVisitor.java b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/KeyExpressionExpansionVisitor.java index 23dcd7b5878..0ee4121538e 100644 --- a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/KeyExpressionExpansionVisitor.java +++ b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/KeyExpressionExpansionVisitor.java @@ -34,6 +34,7 @@ import com.apple.foundationdb.record.metadata.expressions.NestingKeyExpression; import com.apple.foundationdb.record.metadata.expressions.ThenKeyExpression; import com.apple.foundationdb.record.query.plan.cascades.KeyExpressionExpansionVisitor.VisitorState; +import com.apple.foundationdb.record.query.plan.cascades.expressions.ExplodeExpression; import com.apple.foundationdb.record.query.plan.cascades.expressions.SelectExpression; import com.apple.foundationdb.record.query.plan.cascades.predicates.Placeholder; import com.apple.foundationdb.record.query.plan.cascades.predicates.PredicateWithValueAndRanges; @@ -131,7 +132,6 @@ public GraphExpansion visitExpression(@Nonnull FieldKeyExpression fieldKeyExpres final KeyExpression.FanType fanType = fieldKeyExpression.getFanType(); final VisitorState state = getCurrentState(); final List fieldNamePrefix = state.getFieldNamePrefix(); - final Quantifier.ForEach baseQuantifier = state.getBaseQuantifier(); final List fieldNames = ImmutableList.builder() .addAll(fieldNamePrefix) .add(fieldName) @@ -141,8 +141,8 @@ public GraphExpansion visitExpression(@Nonnull FieldKeyExpression fieldKeyExpres switch (fanType) { case FanOut: // explode this field and prefixes of this field - final Quantifier.ForEach childBase = fieldKeyExpression.explodeField(baseQuantifier, fieldNamePrefix); - value = state.registerValue(childBase.getFlowedObjectValue()); + final Quantifier.ForEach childBase = fieldKeyExpression.explodeField(state.getBaseValue(), fieldNamePrefix); + value = state.registerValue(ExplodeExpression.elementValueOf(childBase)); column = Column.unnamedOf(value); final GraphExpansion childExpansion; if (state.isKey() && !state.isInternalExpansion()) { @@ -162,9 +162,11 @@ public GraphExpansion visitExpression(@Nonnull FieldKeyExpression fieldKeyExpres .build(); case Concatenate: case None: - // Note: `Concatenate` and `None` can use the graph expansion logic. Both just access the field directly - // via `FieldValue.ofFieldNames()`. - value = state.registerValue(FieldValue.ofFieldNames(baseQuantifier.getFlowedObjectValue(), fieldNames)); + // Note: `Concatenate` and `None` can use the graph expansion logic. Both just access the field + // directly. The access is fused into the base, which is itself a field access when the base quantifier + // ranges over an explode: a field access whose child is another field access cannot be pulled up, + // since the pull-up rules relate a field path to the quantifier it is rooted in. + value = state.registerValue(FieldValue.ofFieldNamesAndFuseIfPossible(state.getBaseValue(), fieldNames)); if (state.isSelectStar()) { if (state.isKey() && !state.isInternalExpansion()) { return GraphExpansion.ofPlaceholder(value.asPlaceholder(newParameterAlias())); @@ -258,7 +260,6 @@ public GraphExpansion visitExpression(@Nonnull final KeyWithValueExpression keyW public GraphExpansion visitExpression(@Nonnull final NestingKeyExpression nestingKeyExpression) { final VisitorState state = getCurrentState(); final List fieldNamePrefix = state.getFieldNamePrefix(); - final Quantifier.ForEach baseQuantifier = state.getBaseQuantifier(); final FieldKeyExpression parent = nestingKeyExpression.getParent(); final KeyExpression child = nestingKeyExpression.getChild(); @@ -304,7 +305,7 @@ public GraphExpansion visitExpression(@Nonnull final NestingKeyExpression nestin } case FanOut: // explode the parent field(s) also depending on the prefix - final Quantifier.ForEach childBaseQuantifier = parent.explodeField(baseQuantifier, fieldNamePrefix); + final Quantifier.ForEach childBaseQuantifier = parent.explodeField(state.getBaseValue(), fieldNamePrefix); // expand the children of the key expression and then unify them into an expansion of this expression final GraphExpansion childExpansion = pop(child.expand(push(state.withBaseQuantifier(childBaseQuantifier).withFieldNamePrefix(ImmutableList.of())))); @@ -539,6 +540,20 @@ public Quantifier.ForEach getBaseQuantifier() { return baseQuantifier; } + /** + * The value {@link #baseQuantifier} contributes as the base of a field access. That is its flowed object value, + * except under an unnesting: an {@link ExplodeExpression} flows the array element wrapped in a struct, so the + * base is the element within that wrapper. + * + * @return the value field accesses of the current state are relative to + */ + @Nonnull + public Value getBaseValue() { + return baseQuantifier.getRangesOver().get() instanceof ExplodeExpression + ? ExplodeExpression.elementValueOf(baseQuantifier) + : baseQuantifier.getFlowedObjectValue(); + } + @Nonnull public List getFieldNamePrefix() { return fieldNamePrefix; diff --git a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/expressions/ExplodeExpression.java b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/expressions/ExplodeExpression.java index 239eb60202e..90c002f6b0e 100644 --- a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/expressions/ExplodeExpression.java +++ b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/expressions/ExplodeExpression.java @@ -35,10 +35,12 @@ import com.apple.foundationdb.record.query.plan.cascades.explain.PlannerGraph; import com.apple.foundationdb.record.query.plan.cascades.typing.Type; import com.apple.foundationdb.record.query.plan.cascades.values.FieldValue; +import com.apple.foundationdb.record.query.plan.cascades.values.QuantifiedObjectValue; import com.apple.foundationdb.record.query.plan.cascades.values.QueriedValue; import com.apple.foundationdb.record.query.plan.cascades.values.RecordConstructorValue; import com.apple.foundationdb.record.query.plan.cascades.values.Value; import com.apple.foundationdb.record.query.plan.cascades.values.translation.PullUp; +import com.apple.foundationdb.record.query.plan.cascades.values.translation.RegularTranslationMap; import com.apple.foundationdb.record.query.plan.cascades.values.translation.TranslationMap; import com.google.common.base.Verify; import com.google.common.collect.ImmutableList; @@ -65,6 +67,16 @@ */ @API(API.Status.EXPERIMENTAL) public class ExplodeExpression extends AbstractRelationalExpressionWithoutChildren implements InternalPlannerGraphRewritable { + /** + * The ordinal of the array element in the value an explode flows. + */ + public static final int ELEMENT_ORDINAL = 0; + + /** + * The ordinal of the ordinality in the value an explode flows, for the {@code WITH ORDINALITY} variant. + */ + public static final int ORDINALITY_ORDINAL = 1; + @Nonnull private final Value collectionValue; @@ -110,7 +122,8 @@ public ExplodeExpression(@Nonnull final Value collectionValue, final boolean wit } public ExplodeExpression(@Nonnull final Value collectionValue, final boolean withOrdinality) { - this(collectionValue, withOrdinality, false); + // every explode flows a record constructor: of the element alone, or of the element and the ordinal + this(collectionValue, withOrdinality, true); } public ExplodeExpression(@Nonnull final Value collectionValue) { @@ -308,8 +321,56 @@ public String toString() { : collectionValue.toString(); } + /** + * Returns a {@link TranslationMap} that makes each given explode quantifier stand for the array element alone, + * rather than for the record the explode flows. + * + *

A rule that turns explode quantifiers into bindings -- an in-join or an in-union, which bind an + * element of the collection under {@code __corr_«alias»} and re-execute the inner plan per element -- has to apply + * this to the plans it puts underneath, because those plans reference the alias as {@code «alias»._0}. Wrapping + * what the alias stands for lets that access compose away to a plain reference to the binding, which is what the + * runtime actually provides. + * + * @param quantifierToExplodeMap what each explode quantifier ranges over + * + * @return a translation map wrapping each explode alias in the record its explode flows + */ + @Nonnull + public static TranslationMap elementBindingTranslationMap(@Nonnull final Map quantifierToExplodeMap) { + final var translationMapBuilder = RegularTranslationMap.builder(); + for (final var entry : quantifierToExplodeMap.entrySet()) { + final var explodeExpression = entry.getValue(); + if (explodeExpression.isWithOrdinality()) { + // an ordinal cannot be carried by a binding, so such an explode is never turned into one; see the + // callers, which refuse to use it as a source + continue; + } + final var alias = entry.getKey().getAlias(); + final var elementValue = QuantifiedObjectValue.of(alias, explodeExpression.getElementType()); + translationMapBuilder.when(alias).then((sourceAlias, leafValue) -> + RecordConstructorValue.ofColumns(ImmutableList.of(Column.unnamedOf(elementValue)), true)); + } + return translationMapBuilder.build(); + } + + /** + * Returns the value standing for the array element an explode quantifier ranges over, reached through the record + * the explode flows. + */ + @Nonnull + public static Value elementValueOf(@Nonnull final Quantifier explodeQuantifier) { + return FieldValue.ofOrdinalNumber(explodeQuantifier.getFlowedObjectValue(), ELEMENT_ORDINAL); + } + + @Nonnull public static ExplodeExpression explodeField(@Nonnull final Quantifier.ForEach baseQuantifier, @Nonnull final List fieldNames) { - return new ExplodeExpression(FieldValue.ofFieldNames(baseQuantifier.getFlowedObjectValue(), fieldNames)); + return explodeField(baseQuantifier.getFlowedObjectValue(), fieldNames); + } + + @Nonnull + public static ExplodeExpression explodeField(@Nonnull final Value baseValue, + @Nonnull final List fieldNames) { + return new ExplodeExpression(FieldValue.ofFieldNamesAndFuseIfPossible(baseValue, fieldNames)); } } diff --git a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/rules/ImplementInJoinRule.java b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/rules/ImplementInJoinRule.java index db949a639fd..d643f186895 100644 --- a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/rules/ImplementInJoinRule.java +++ b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/rules/ImplementInJoinRule.java @@ -30,6 +30,7 @@ import com.apple.foundationdb.record.query.plan.cascades.ImplementationCascadesRuleCall; import com.apple.foundationdb.record.query.plan.cascades.LinkedIdentityMap; import com.apple.foundationdb.record.query.plan.cascades.LinkedIdentitySet; +import com.apple.foundationdb.record.query.plan.cascades.Memoizer; import com.apple.foundationdb.record.query.plan.cascades.Ordering; import com.apple.foundationdb.record.query.plan.cascades.Ordering.Binding; import com.apple.foundationdb.record.query.plan.cascades.OrderingPart.ProvidedOrderingPart; @@ -53,7 +54,7 @@ import com.apple.foundationdb.record.query.plan.plans.InParameterSource; import com.apple.foundationdb.record.query.plan.plans.InSource; import com.apple.foundationdb.record.query.plan.plans.InValuesSource; -import com.apple.foundationdb.record.query.plan.plans.RecordQueryInUnionPlan; +import com.apple.foundationdb.record.query.plan.plans.RecordQueryInJoinPlan; import com.apple.foundationdb.record.query.plan.plans.SortedInComparandSource; import com.apple.foundationdb.record.query.plan.plans.SortedInParameterSource; import com.apple.foundationdb.record.query.plan.plans.SortedInValuesSource; @@ -84,7 +85,7 @@ import static com.apple.foundationdb.record.query.plan.cascades.rules.PushRequestedOrderingThroughInLikeSelectRule.findInnerQuantifier; /** - * A rule that implements a SELECT over a VALUES and a correlated subexpression as a {@link RecordQueryInUnionPlan}. + * A rule that implements a SELECT over a VALUES and a correlated subexpression as a {@link RecordQueryInJoinPlan}. */ @API(API.Status.EXPERIMENTAL) @SuppressWarnings({"PMD.TooManyStaticImports", "java:S4738", "java:S3776"}) @@ -145,6 +146,8 @@ public void onMatch(@Nonnull final ImplementationCascadesRuleCall call) { final var innerReference = innerQuantifier.getRangesOver(); final var planPartitions = PlanPartitions.rollUpTo(innerReference.toPlanPartitions(), OrderingProperty.ordering()); + final var elementTranslationMap = ExplodeExpression.elementBindingTranslationMap(quantifierToExplodeBiMap); + for (final var planPartition : planPartitions) { final var providedOrdering = planPartition.getPartitionPropertyValue(OrderingProperty.ordering()); @@ -155,10 +158,16 @@ public void onMatch(@Nonnull final ImplementationCascadesRuleCall call) { sourcesStream.forEach(sources -> { final var reverseSources = Lists.reverse(sources); - var newInnerPlanReference = call.memoizeMemberPlansBuilder(innerReference, planPartition.getPlans()); + var innerPlanReference = + call.memoizeMemberPlansBuilder(innerReference, planPartition.getPlans()) + .reference() + .translateGraph(Memoizer.noMemoization(innerReference.getPlannerStage()), + elementTranslationMap, true); + Memoizer.ReferenceOfPlansBuilder newInnerPlanReference = null; for (final InSource inSource : reverseSources) { - final var inJoinPlan = inSource.toInJoinPlan(Quantifier.physical(newInnerPlanReference.reference())); + final var inJoinPlan = inSource.toInJoinPlan(Quantifier.physical(innerPlanReference)); newInnerPlanReference = call.memoizePlanBuilder(inJoinPlan); + innerPlanReference = newInnerPlanReference.reference(); } call.yieldPlans(newInnerPlanReference.members()); @@ -167,6 +176,7 @@ public void onMatch(@Nonnull final ImplementationCascadesRuleCall call) { } } + @Nonnull private Stream> enumerateInSourcesForRequestedOrdering(@Nonnull final Map explodeAliasToQuantifierMap, @Nonnull final Set explodeAliases, @@ -255,7 +265,7 @@ private Stream> enumerateInSourcesForRequestedOrdering(@Nonnull f attemptedSortOrders.stream() .flatMap(attemptedSortOrder -> { final InSource inSource = - computeInSource(explodeValue, explodeQuantifier, attemptedSortOrder); + computeInSource(explodeExpression, explodeQuantifier, attemptedSortOrder); return inSource == null ? Stream.empty() : Stream.of(ImmutableList.builder().addAll(prefix) @@ -355,20 +365,18 @@ private static Stream> suffixForRemainingExplodes(@ final var explodeExpression = Objects.requireNonNull(quantifierToExplodeMap.get((Quantifier.ForEach)explodeQuantifier)); - final var explodeValue = explodeExpression.getCollectionValue(); - final var orderingResultsBuilder = ImmutableList.builder(); if (attemptedSortOrders == null) { Verify.verify(!requestedOrdering.isExhaustive()); final InSource inSource = - computeInSource(explodeValue, explodeQuantifier, null); + computeInSource(explodeExpression, explodeQuantifier, null); if (inSource != null) { orderingResultsBuilder.add(new OrderingPartWithSource(null, inSource)); } } else { for (final var attemptedSortOrder : attemptedSortOrders) { final InSource inSource = - computeInSource(explodeValue, explodeQuantifier, attemptedSortOrder); + computeInSource(explodeExpression, explodeQuantifier, attemptedSortOrder); if (inSource != null) { orderingResultsBuilder.add(new OrderingPartWithSource(null, inSource)); @@ -401,9 +409,14 @@ private static List attemptedProvidedSortOrdersForAny(final b @Nullable @SuppressWarnings("unchecked") - private static InSource computeInSource(@Nonnull final Value explodeValue, + private static InSource computeInSource(@Nonnull final ExplodeExpression explodeExpression, @Nonnull final Quantifier explodeQuantifier, @Nullable final ProvidedSortOrder attemptedSortOrder) { + if (explodeExpression.isWithOrdinality()) { + // an in-join binds an element of the collection, and there is nowhere to put the ordinal that goes with it + return null; + } + final var explodeValue = explodeExpression.getCollectionValue(); final String bindingName = CORRELATION.bindingName(explodeQuantifier.getAlias().getId()); if (explodeValue instanceof LiteralValue) { final Object literalValue = ((LiteralValue)explodeValue).getLiteralValue(); diff --git a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/rules/ImplementInUnionRule.java b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/rules/ImplementInUnionRule.java index 5dced924428..29504a64e93 100644 --- a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/rules/ImplementInUnionRule.java +++ b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/rules/ImplementInUnionRule.java @@ -26,6 +26,7 @@ import com.apple.foundationdb.record.query.plan.cascades.CorrelationIdentifier; import com.apple.foundationdb.record.query.plan.cascades.ImplementationCascadesRule; import com.apple.foundationdb.record.query.plan.cascades.ImplementationCascadesRuleCall; +import com.apple.foundationdb.record.query.plan.cascades.Memoizer; import com.apple.foundationdb.record.query.plan.cascades.Ordering; import com.apple.foundationdb.record.query.plan.cascades.Ordering.Binding; import com.apple.foundationdb.record.query.plan.cascades.OrderingPart; @@ -58,6 +59,7 @@ import javax.annotation.Nonnull; import javax.annotation.Nullable; import java.util.Collection; +import java.util.LinkedHashMap; import java.util.List; import java.util.Set; @@ -131,6 +133,10 @@ public void onMatch(@Nonnull final ImplementationCascadesRuleCall call) { int i = 0; for (final var explodeQuantifier : explodeQuantifiers) { final var explodeExpression = explodeExpressions.get(i++); + if (explodeExpression.isWithOrdinality()) { + // an in-union binds an element of the collection, and there is nowhere to put the ordinal + return; + } final Value explodeCollectionValue = explodeExpression.getCollectionValue(); // @@ -161,7 +167,19 @@ public void onMatch(@Nonnull final ImplementationCascadesRuleCall call) { } final var inSources = sourcesBuilder.build(); - + + // + // An in-union binds the array element itself under the explode's alias, while the explode flows that element + // wrapped in a struct. Wrap what the alias stands for accordingly, so that an access of the element within the + // inner plans composes away to a plain reference to the binding. + // + final var quantifierToExplodeMap = new LinkedHashMap(); + int explodeIndex = 0; + for (final var explodeQuantifier : explodeQuantifiers) { + quantifierToExplodeMap.put(explodeQuantifier, explodeExpressions.get(explodeIndex++)); + } + final var elementTranslationMap = ExplodeExpression.elementBindingTranslationMap(quantifierToExplodeMap); + final var innerReference = innerQuantifier.getRangesOver(); final var planPartitions = PlanPartitions.rollUpTo( @@ -202,7 +220,13 @@ public void onMatch(@Nonnull final ImplementationCascadesRuleCall call) { // // At this point we know we can implement the distinct union over the partitions of compatibly ordered plans // - final Quantifier.Physical newInnerQuantifier = Quantifier.physical(call.memoizeMemberPlansFromOther(innerReference, planPartition.getPlans())); + final var translatedReference = + call.memoizeMemberPlansFromOther(innerReference, planPartition.getPlans()) + .translateGraph(Memoizer.noMemoization(innerReference.getPlannerStage()), + elementTranslationMap, true); + final Quantifier.Physical newInnerQuantifier = + Quantifier.physical(call.memoizeFinalExpressionsFromOther(translatedReference, + translatedReference.getFinalExpressions())); call.yieldPlan( RecordQueryInUnionPlan.from(newInnerQuantifier, inSources, diff --git a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/rules/InComparisonToExplodeRule.java b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/rules/InComparisonToExplodeRule.java index 6906616e616..5b5780d700b 100644 --- a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/rules/InComparisonToExplodeRule.java +++ b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/rules/InComparisonToExplodeRule.java @@ -25,7 +25,6 @@ import com.apple.foundationdb.record.query.expressions.Comparisons; import com.apple.foundationdb.record.query.plan.cascades.AbstractCascadesRule; import com.apple.foundationdb.record.query.plan.cascades.CallSiteArguments; -import com.apple.foundationdb.record.query.plan.cascades.Column; import com.apple.foundationdb.record.query.plan.cascades.ExplorationCascadesRule; import com.apple.foundationdb.record.query.plan.cascades.ExplorationCascadesRuleCall; import com.apple.foundationdb.record.query.plan.cascades.Quantifier; @@ -39,10 +38,8 @@ import com.apple.foundationdb.record.query.plan.cascades.typing.Type; import com.apple.foundationdb.record.query.plan.cascades.values.ArrayDistinctValue; import com.apple.foundationdb.record.query.plan.cascades.values.BooleanValue; -import com.apple.foundationdb.record.query.plan.cascades.values.FieldValue; import com.apple.foundationdb.record.query.plan.cascades.values.LiteralValue; import com.apple.foundationdb.record.query.plan.cascades.values.ParameterObjectValue; -import com.apple.foundationdb.record.query.plan.cascades.values.QuantifiedObjectValue; import com.apple.foundationdb.record.query.plan.cascades.values.RelOpValue; import com.apple.foundationdb.record.query.plan.cascades.values.Value; import com.apple.foundationdb.record.query.plan.cascades.values.Values; @@ -169,23 +166,24 @@ public void onMatch(@Nonnull final ExplorationCascadesRuleCall call) { explodeExpression = new ExplodeExpression(new ArrayDistinctValue(comparisonValue.getComparandValue())); newQuantifier = Quantifier.forEach(call.memoizeExploratoryExpression(explodeExpression)); if (arrayElementType.isRecord()) { - transformedPredicates.addAll(createSimpleEqualitiesForRecordTypeValue(value, newQuantifier)); + transformedPredicates.addAll(createSimpleEqualitiesForRecordTypeValue(value, + ExplodeExpression.elementValueOf(newQuantifier))); } else { transformedPredicates.add(new ValuePredicate(value, - new Comparisons.ValueComparison(Comparisons.Type.EQUALS, QuantifiedObjectValue.of(newQuantifier.getAlias(), elementType)))); + new Comparisons.ValueComparison(Comparisons.Type.EQUALS, ExplodeExpression.elementValueOf(newQuantifier)))); } } else if (comparison instanceof Comparisons.ListComparison) { final var listComparison = (Comparisons.ListComparison)comparison; explodeExpression = new ExplodeExpression(LiteralValue.ofList((List)listComparison.getComparand(null, null))); newQuantifier = Quantifier.forEach(call.memoizeExploratoryExpression(explodeExpression)); transformedPredicates.add(new ValuePredicate(value, - new Comparisons.ValueComparison(Comparisons.Type.EQUALS, QuantifiedObjectValue.of(newQuantifier.getAlias(), elementType)))); + new Comparisons.ValueComparison(Comparisons.Type.EQUALS, ExplodeExpression.elementValueOf(newQuantifier)))); } else if (comparison instanceof Comparisons.ParameterComparison) { explodeExpression = new ExplodeExpression(ParameterObjectValue.of(((Comparisons.ParameterComparison)comparison).getParameter(), new Type.Array(elementType))); newQuantifier = Quantifier.forEach(call.memoizeExploratoryExpression(explodeExpression)); transformedPredicates.add(new ValuePredicate(value, - new Comparisons.ValueComparison(Comparisons.Type.EQUALS, QuantifiedObjectValue.of(newQuantifier.getAlias(), elementType)))); + new Comparisons.ValueComparison(Comparisons.Type.EQUALS, ExplodeExpression.elementValueOf(newQuantifier)))); } else { throw new RecordCoreException("unknown in comparison " + comparison.getClass().getSimpleName()); } @@ -206,16 +204,16 @@ public void onMatch(@Nonnull final ExplorationCascadesRuleCall call) { */ @Nonnull private static List createSimpleEqualitiesForRecordTypeValue(@Nonnull final Value value, - @Nonnull final Quantifier.ForEach newQuantifier) { + @Nonnull final Value comparandValue) { Verify.verify(value.getResultType().isRecord(), "value should be of type record and not %s", value.getResultType()); final List fieldValues = Values.deconstructRecord(value); - List> comparandValueChildren = newQuantifier.getFlowedColumns(); + final List comparandValueChildren = Values.deconstructRecord(comparandValue); Verify.verify(fieldValues.size() == comparandValueChildren.size(), "record type value and comparand should have matching number of fields"); final var resultsBuilder = ImmutableList.builder(); for (int i = 0; i < fieldValues.size(); i++) { final Value fieldValue = fieldValues.get(i); - BooleanValue currentVal = (BooleanValue) new RelOpValue.EqualsFn().encapsulate(CallSiteArguments.ofPositional(fieldValue, comparandValueChildren.get(i).getValue())); + BooleanValue currentVal = (BooleanValue) new RelOpValue.EqualsFn().encapsulate(CallSiteArguments.ofPositional(fieldValue, comparandValueChildren.get(i))); Optional currentQueryPredicate = currentVal.toQueryPredicate(null, Quantifier.current()); Verify.verify(currentQueryPredicate.isPresent()); resultsBuilder.add(currentQueryPredicate.get()); diff --git a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/typing/Type.java b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/typing/Type.java index c5ec5794640..620af62a207 100644 --- a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/typing/Type.java +++ b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/typing/Type.java @@ -644,7 +644,9 @@ static Type maximumType(@Nonnull final Type t1, @Nonnull final Type t2) { return null; } - final var resultFieldsBuilder = ImmutableList.builder(); + final var resultFieldTypes = new ArrayList(t1Fields.size()); + final var resultFieldNameOptionals = new ArrayList>(t1Fields.size()); + final var resultFieldIndexOptionals = new ArrayList>(t1Fields.size()); for (int i = 0; i < t1Fields.size(); i++) { final var t1Field = t1Fields.get(i); final var t2Field = t2Fields.get(i); @@ -653,6 +655,7 @@ static Type maximumType(@Nonnull final Type t1, @Nonnull final Type t2) { if (resultFieldType == null) { return null; } + resultFieldTypes.add(resultFieldType); Optional resultFieldNameOptional = Optional.empty(); if (t1Field.getFieldNameOptional().isEmpty()) { @@ -660,8 +663,22 @@ static Type maximumType(@Nonnull final Type t1, @Nonnull final Type t2) { } else if (t2Field.getFieldNameOptional().isEmpty() || (t1Field.getFieldNameOptional().equals(t2Field.getFieldNameOptional()))) { resultFieldNameOptional = t1Field.getFieldNameOptional(); } + resultFieldNameOptionals.add(resultFieldNameOptional); - resultFieldsBuilder.add(Record.Field.of(resultFieldType, resultFieldNameOptional)); + resultFieldIndexOptionals.add( + t1Field.getFieldIndexOptional().equals(t2Field.getFieldIndexOptional()) + ? t1Field.getFieldIndexOptional() + : Optional.empty()); + } + // best-case effort to preserve the index of the Type.Record.Field. That is, the index is kept only if + // the two corresponding fields from `Type.Record`s have the same index. + final var keepFieldIndexes = resultFieldIndexOptionals.stream().allMatch(Optional::isPresent); + final var resultFieldsBuilder = ImmutableList.builder(); + for (int i = 0; i < resultFieldTypes.size(); i++) { + resultFieldsBuilder.add(keepFieldIndexes + ? Record.Field.of(resultFieldTypes.get(i), resultFieldNameOptionals.get(i), + resultFieldIndexOptionals.get(i)) + : Record.Field.of(resultFieldTypes.get(i), resultFieldNameOptionals.get(i))); } return Type.Record.fromFields(isResultNullable, resultFieldsBuilder.build()); diff --git a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/values/FieldValue.java b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/values/FieldValue.java index f9dcbb958df..7383474dcc8 100644 --- a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/values/FieldValue.java +++ b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/cascades/values/FieldValue.java @@ -317,6 +317,12 @@ public static FieldValue ofFieldNames(@Nonnull Value childValue, @Nonnull final return new FieldValue(childValue, resolved); } + @Nonnull + public static FieldValue ofFieldNamesAndFuseIfPossible(@Nonnull Value childValue, @Nonnull final List fieldNames) { + final var resolved = resolveFieldPath(childValue.getResultType(), fieldNames.stream().map(fieldName -> new Accessor(fieldName, -1)).collect(ImmutableList.toImmutableList())); + return ofFieldsAndFuseIfPossible(childValue, resolved); + } + @Nonnull public static FieldValue ofFields(@Nonnull Value childValue, @Nonnull final FieldPath fieldPath) { return new FieldValue(childValue, fieldPath); diff --git a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/plans/RecordQueryExplodePlan.java b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/plans/RecordQueryExplodePlan.java index 196464c9f8a..67d036a819b 100644 --- a/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/plans/RecordQueryExplodePlan.java +++ b/fdb-record-layer-core/src/main/java/com/apple/foundationdb/record/query/plan/plans/RecordQueryExplodePlan.java @@ -137,7 +137,8 @@ public RecordQueryExplodePlan(@Nonnull Value collectionValue, boolean withOrdina } public RecordQueryExplodePlan(@Nonnull Value collectionValue, boolean withOrdinality) { - this(collectionValue, withOrdinality, false); + // every explode flows a record constructor: of the element alone, or of the element and the ordinal + this(collectionValue, withOrdinality, true); } public RecordQueryExplodePlan(@Nonnull Value collectionValue) { diff --git a/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/query/plan/cascades/TypeTest.java b/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/query/plan/cascades/TypeTest.java index f86d6973d0b..78a2368c48c 100644 --- a/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/query/plan/cascades/TypeTest.java +++ b/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/query/plan/cascades/TypeTest.java @@ -1361,4 +1361,39 @@ void testFunctionTypeIsSingleton() { Assertions.assertSame(function1, function2, "Type.FUNCTION should be a singleton"); } + + @Nonnull + private static Type.Record recordWithFieldIndexes(@Nonnull final List fieldIndexes) { + final var fields = ImmutableList.builder(); + for (int i = 0; i < fieldIndexes.size(); i++) { + fields.add(Type.Record.Field.of(Type.primitiveType(Type.TypeCode.STRING, true), + Optional.of("f" + i), Optional.of(fieldIndexes.get(i)))); + } + return Type.Record.fromFields(fields.build()); + } + + @Nonnull + private static List fieldIndexesOf(@Nullable final Type type) { + return Objects.requireNonNull((Type.Record)type).getFields() + .stream() + .map(Type.Record.Field::getFieldIndex) + .toList(); + } + + @Test + void maximumTypeKeepsFieldIndexesThatBothSidesAgreeOn() { + final var skipping = recordWithFieldIndexes(List.of(1, 3, 4)); + Assertions.assertEquals(List.of(1, 3, 4), fieldIndexesOf(Type.maximumType(skipping, skipping))); + } + + @Test + void maximumTypeRenumbersFieldIndexesThatDisagree() { + final var skipping = recordWithFieldIndexes(List.of(1, 3, 4)); + final var otherSkipping = recordWithFieldIndexes(List.of(1, 3, 5)); + + // Nothing can be said about the numbering of the result, so it is numbered by position, as it always was. + Assertions.assertEquals(List.of(1, 2, 3), fieldIndexesOf(Type.maximumType(skipping, otherSkipping))); + Assertions.assertEquals(List.of(1, 2, 3), + fieldIndexesOf(Type.maximumType(skipping, recordWithFieldIndexes(List.of(1, 2, 3))))); + } } diff --git a/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/query/plan/plans/ExplodePlanTest.java b/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/query/plan/plans/ExplodePlanTest.java index 34170d92ef5..0af8b2b3b7b 100644 --- a/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/query/plan/plans/ExplodePlanTest.java +++ b/fdb-record-layer-core/src/test/java/com/apple/foundationdb/record/query/plan/plans/ExplodePlanTest.java @@ -43,6 +43,7 @@ import com.apple.foundationdb.record.query.plan.cascades.values.translation.TranslationMap; import com.apple.foundationdb.record.query.plan.serialization.DefaultPlanSerializationRegistry; import com.google.common.collect.ImmutableList; +import com.google.protobuf.Descriptors; import com.google.protobuf.Message; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; @@ -66,7 +67,15 @@ public class ExplodePlanTest { private static final class ExplodeCursorBuilder { @Nonnull - private final RecordQueryPlan explodePlan; + private final RecordQueryExplodePlan explodePlan; + + /** + * The repository the plan looks the descriptor of the record it flows up in. One per builder: the messages the + * cursor produces carry the descriptor from this repository, and only field descriptors from the same one can + * read them. + */ + @Nonnull + private final TypeRepository typeRepository; @Nonnull private Optional skip; @@ -76,6 +85,7 @@ private static final class ExplodeCursorBuilder { private ExplodeCursorBuilder() { explodePlan = generateExplodePlan(); + typeRepository = TypeRepository.newBuilder().addTypeIfNeeded(explodePlan.getExplodeResultType()).build(); skip = Optional.empty(); limit = Optional.empty(); } @@ -106,11 +116,22 @@ RecordCursor build() { skip.ifPresent(executionPropertiesBuilder::setSkip); limit.ifPresent(executionPropertiesBuilder::setReturnedRowLimit); final var executionProperties = executionPropertiesBuilder.build(); - return explodePlan.executePlan(null, EvaluationContext.EMPTY, null, executionProperties); + return explodePlan.executePlan(null, EvaluationContext.forTypeRepository(typeRepository), null, + executionProperties); } + /** + * The descriptor of the element field of the record the explode flows. + */ @Nonnull - private static RecordQueryPlan generateExplodePlan() { + Descriptors.FieldDescriptor elementField() { + final var descriptor = + Objects.requireNonNull(typeRepository.getMessageDescriptor(explodePlan.getExplodeResultType())); + return descriptor.getFields().get(ExplodeExpression.ELEMENT_ORDINAL); + } + + @Nonnull + private static RecordQueryExplodePlan generateExplodePlan() { final Value collectionValue = LiteralValue.ofList(List.of(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)); return new RecordQueryExplodePlan(collectionValue); } @@ -121,14 +142,18 @@ public static ExplodeCursorBuilder instance() { } } - private static void verifyCursor(@Nonnull final RecordCursor actualCursor, + private static void verifyCursor(@Nonnull final ExplodeCursorBuilder actualCursorBuilder, @Nonnull final List expectedResults, boolean verifyLimitExceeded) { + final var actualCursor = actualCursorBuilder.build(); + final var elementField = actualCursorBuilder.elementField(); for (final var expectedValue : expectedResults) { final var result = actualCursor.getNext(); Assertions.assertTrue(result.hasNext()); Assertions.assertNotNull(result.get()); - Assertions.assertEquals(expectedValue, Objects.requireNonNull(result.get()).getDatum()); + // an explode flows the element wrapped in a record, so the element is read out of that record + final var message = (Message)Objects.requireNonNull(result.get()).getDatum(); + Assertions.assertEquals(expectedValue, message.getField(elementField)); } if (verifyLimitExceeded) { final var result = actualCursor.getNext(); @@ -155,7 +180,7 @@ public Stream provideArguments(final ParameterDeclarations void explodeWithSkipAndLimitWorks(@Nonnull final ExplodeCursorBuilder actualCursorBuilder, @Nonnull final List expectedResult, boolean shouldReachLimit) { - verifyCursor(actualCursorBuilder.build(), expectedResult, shouldReachLimit); + verifyCursor(actualCursorBuilder, expectedResult, shouldReachLimit); } @Test @@ -248,10 +273,17 @@ void protoRoundTripPreservesWithOrdinality() { } // Pinned hash values for the `planHashIsStable()` test. - private static final int WITHOUT_ORDINALITY_LEGACY_HASH = -1251896027; - private static final int WITHOUT_ORDINALITY_FOR_CONTINUATION_HASH = -1251896027; - private static final int WITH_ORDINALITY_LEGACY_HASH = -481199675; - private static final int WITH_ORDINALITY_FOR_CONTINUATION_HASH = -481199675; + // The plain hashes are those of the record constructor, which is what such a plan now flows. + private static final int WITHOUT_ORDINALITY_LEGACY_HASH = 1014226403; + private static final int WITHOUT_ORDINALITY_FOR_CONTINUATION_HASH = 1014226403; + // What a plain plan that flows the element itself hashes to, which is every plan serialized before this change. + private static final int WITHOUT_ORDINALITY_ELEMENT_LEGACY_HASH = -1251896027; + private static final int WITHOUT_ORDINALITY_ELEMENT_FOR_CONTINUATION_HASH = -1251896027; + // The ordinality hashes are those of the record constructor, which is what such a plan now flows. They are the + // hashes a plan that asked for 0-based ordinals had while the ordinal base was still a choice, which is the one + // combination that still exists. + private static final int WITH_ORDINALITY_LEGACY_HASH = -961118966; + private static final int WITH_ORDINALITY_FOR_CONTINUATION_HASH = -961118966; @Test void planHashIsStable() { @@ -263,6 +295,12 @@ void planHashIsStable() { Assertions.assertEquals(WITHOUT_ORDINALITY_FOR_CONTINUATION_HASH, withoutOrdinality.planHash(PlanHashable.CURRENT_FOR_CONTINUATION)); + final var withoutOrdinalityFlowingTheElement = new RecordQueryExplodePlan(collectionValue, false, false); + Assertions.assertEquals(WITHOUT_ORDINALITY_ELEMENT_LEGACY_HASH, + withoutOrdinalityFlowingTheElement.planHash(PlanHashable.CURRENT_LEGACY)); + Assertions.assertEquals(WITHOUT_ORDINALITY_ELEMENT_FOR_CONTINUATION_HASH, + withoutOrdinalityFlowingTheElement.planHash(PlanHashable.CURRENT_FOR_CONTINUATION)); + final var withOrdinality = new RecordQueryExplodePlan(collectionValue, true); Assertions.assertEquals(WITH_ORDINALITY_LEGACY_HASH, withOrdinality.planHash(PlanHashable.CURRENT_LEGACY)); @@ -405,10 +443,10 @@ void protoMarksTheOrdinalsOfAWithOrdinalityPlanZeroBased() { @Test void theFlagDecidesTheShapeOfTheFlowedValue() { final var collectionValue = LiteralValue.ofList(List.of(1, 2, 3)); - final var elementValue = new RecordQueryExplodePlan(collectionValue, false).getResultValue(); + final var elementValue = new RecordQueryExplodePlan(collectionValue, false, false).getResultValue(); // The shape existing plans get: one opaque value standing for the whole struct, with nothing inside it reachable. - final var opaque = new RecordQueryExplodePlan(collectionValue, true); + final var opaque = new RecordQueryExplodePlan(collectionValue, true, false); Assertions.assertFalse(opaque.flowsRecordConstructorValue()); Assertions.assertInstanceOf(QueriedValue.class, opaque.getResultValue()); @@ -434,14 +472,14 @@ void theShapeOfTheFlowedValueIsPartOfIdentity() { // Two plans that flow the same data in different shapes are not interchangeable, since what is reachable in the // value each flows differs, and neither may be substituted for the other under a continuation. - final var opaque = new RecordQueryExplodePlan(collectionValue, true); + final var opaque = new RecordQueryExplodePlan(collectionValue, true, false); final var recordConstructor = new RecordQueryExplodePlan(collectionValue, true, true); Assertions.assertNotEquals(opaque, recordConstructor); Assertions.assertNotEquals(opaque.planHash(PlanHashable.CURRENT_FOR_CONTINUATION), recordConstructor.planHash(PlanHashable.CURRENT_FOR_CONTINUATION)); // The same holds of the plain variant, where the shape decides the type the plan flows as well. - final var plainElement = new RecordQueryExplodePlan(collectionValue, false); + final var plainElement = new RecordQueryExplodePlan(collectionValue, false, false); final var plainRecordConstructor = new RecordQueryExplodePlan(collectionValue, false, true); Assertions.assertNotEquals(plainElement, plainRecordConstructor); Assertions.assertNotEquals(plainElement.planHash(PlanHashable.CURRENT_FOR_CONTINUATION), @@ -455,9 +493,9 @@ void theShapeOfTheFlowedValueEntersTheSemanticHash() { Assertions.assertEquals(new ExplodeExpression(collectionValue, true, true).semanticHashCode(), new ExplodeExpression(collectionValue, true, true).semanticHashCode()); - Assertions.assertNotEquals(new ExplodeExpression(collectionValue, true).semanticHashCode(), + Assertions.assertNotEquals(new ExplodeExpression(collectionValue, true, false).semanticHashCode(), new ExplodeExpression(collectionValue, true, true).semanticHashCode()); - Assertions.assertNotEquals(new ExplodeExpression(collectionValue).semanticHashCode(), + Assertions.assertNotEquals(new ExplodeExpression(collectionValue, false, false).semanticHashCode(), new ExplodeExpression(collectionValue, false, true).semanticHashCode()); } @@ -466,7 +504,7 @@ void plainExplodeCanFlowARecordConstructorToo() { final var collectionValue = LiteralValue.ofList(List.of(1, 2, 3)); // The shape existing plans get: the element itself, which is also the plan's result type. - final var element = new RecordQueryExplodePlan(collectionValue, false); + final var element = new RecordQueryExplodePlan(collectionValue, false, false); final var elementValue = element.getResultValue(); Assertions.assertInstanceOf(QueriedValue.class, elementValue); Assertions.assertEquals(element.getElementType(), element.getExplodeResultType()); @@ -486,12 +524,12 @@ void plainExplodeCanFlowARecordConstructorToo() { // Unlike WITH ORDINALITY, where the struct is the result type either way, the shape decides the plain variant's // result type. Assertions.assertNotEquals(element.getExplodeResultType(), recordConstructor.getExplodeResultType()); - Assertions.assertEquals(new RecordQueryExplodePlan(collectionValue, true).getExplodeResultType(), + Assertions.assertEquals(new RecordQueryExplodePlan(collectionValue, true, false).getExplodeResultType(), new RecordQueryExplodePlan(collectionValue, true, true).getExplodeResultType()); Assertions.assertTrue(recordConstructor.getDynamicTypes().contains(recordConstructor.getExplodeResultType())); // An expression flows what the plan implementing it flows. - final var expression = new ExplodeExpression(collectionValue, false, true); + final var expression = new ExplodeExpression(collectionValue, false); Assertions.assertTrue(expression.flowsRecordConstructorValue()); Assertions.assertEquals(recordConstructor.getExplodeResultType(), expression.getExplodeResultType()); Assertions.assertEquals(recordConstructor.getResultValue(), expression.getResultValue()); @@ -549,7 +587,7 @@ void protoRoundTripPreservesTheShapeOfTheFlowedValue() { // A plan flowing the opaque value must not set the field at all, so that it serializes to exactly the bytes it // serialized to before the field existed. - final var opaque = new RecordQueryExplodePlan(collectionValue, true); + final var opaque = new RecordQueryExplodePlan(collectionValue, true, false); final var opaqueProto = opaque.toProto(newSerializationContext()); Assertions.assertFalse(opaqueProto.hasFlowsRecordConstructorValue()); @@ -571,7 +609,7 @@ void protoRoundTripPreservesTheShapeOfTheFlowedValue() { Assertions.assertEquals(plainRecordConstructor, RecordQueryExplodePlan.fromProto(newSerializationContext(), plainRecordConstructorProto)); - final var plainElement = new RecordQueryExplodePlan(collectionValue, false); + final var plainElement = new RecordQueryExplodePlan(collectionValue, false, false); Assertions.assertFalse(plainElement.toProto(newSerializationContext()).hasFlowsRecordConstructorValue()); Assertions.assertEquals(plainElement, RecordQueryExplodePlan.fromProto(newSerializationContext(), PRecordQueryExplodePlan.newBuilder() diff --git a/fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/LogicalOperator.java b/fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/LogicalOperator.java index e95f70e9ddc..1112a6ec97a 100644 --- a/fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/LogicalOperator.java +++ b/fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/LogicalOperator.java @@ -312,31 +312,38 @@ private static LogicalOperator generateCorrelatedFieldAccess(@Nonnull Expression ErrorCode.INVALID_COLUMN_REFERENCE, () -> String.format(Locale.ROOT, "join correlation can occur only on column of repeated type, not %s type", expression.getDataType())); final boolean withOrdinality = atAlias.isPresent(); - // for the case when `withOrdinality` is true, we ask for a RecordConstructor value. - final var explode = new ExplodeExpression(expression.getUnderlying(), withOrdinality, withOrdinality); - final var resultingQuantifier = Quantifier.forEach(Reference.initialOf(explode)); - final QuantifiedObjectValue flowedObjectValue = resultingQuantifier.getFlowedObjectValue(); - final Type flowedObjectType = resultingQuantifier.getFlowedObjectType(); - + // `AT` is 1-based per the SQL standard, but the one is added below, where the `AT` alias is bound, so that the + // ordinal an index candidate matches against is the position it stores. + final ExplodeExpression explodeExpression = + new ExplodeExpression(expression.getUnderlying(), withOrdinality, true); + final Quantifier.ForEach resultingQuantifier = Quantifier.forEach(Reference.initialOf(explodeExpression)); + final Value elementValue = FieldValue.ofOrdinalNumber(resultingQuantifier.getFlowedObjectValue(), + ExplodeExpression.ELEMENT_ORDINAL); + + final Type elementType = explodeExpression.getElementType(); final ImmutableList.Builder attributesBuilder = ImmutableList.builder(); + if (elementType.isPrimitive()) { + attributesBuilder.add(new Expression(alias, DataTypeUtils.toRelationalType(elementType), elementValue)); + } else { + attributesBuilder.addAll(convertToExpressions(elementValue)); + } if (atAlias.isPresent()) { - // With AT, the `ExplodeExpression` produces a struct (element, ordinal). Use `FieldValue` accessors. - final Type elementType = explode.getElementType(); - attributesBuilder.add(new Expression(alias, DataTypeUtils.toRelationalType(elementType), - FieldValue.ofOrdinalNumber(flowedObjectValue, 0))); + // + // The ordinal is a property of the unnesting rather than a column of the row, so it is not part of a star + // expansion -- the same treatment the row version pseudo field gets above. It stays resolvable by name, + // which `Visibility.HIDDEN` would not allow once the attribute carries a qualifier. + // // The explode flows 0-based ordinals. SQL `AT` is 1-based per the standard. // TODO: An `AT` ordinal is never null, but `ArithmeticValue` reports a nullable result type even when both // of its operands are not nullable, so the column is declared nullable to match the value it flows. // Once #4622 is fixed, this should go back to `DataType.Primitives.INTEGER`. final Value oneBasedOrdinal = (Value)new ArithmeticValue.AddFn() - .encapsulate(CallSiteArguments.ofPositional(FieldValue.ofOrdinalNumber(flowedObjectValue, 1), + .encapsulate(CallSiteArguments.ofPositional( + FieldValue.ofOrdinalNumber(resultingQuantifier.getFlowedObjectValue(), + ExplodeExpression.ORDINALITY_ORDINAL), LiteralValue.ofScalar(1))); - attributesBuilder.add(new Expression(atAlias, DataType.Primitives.NULLABLE_INTEGER.type(), oneBasedOrdinal)); - } else if (flowedObjectType.isPrimitive()) { - attributesBuilder.add(new Expression(alias, DataTypeUtils.toRelationalType(explode.getExplodeResultType()), - flowedObjectValue)); - } else { - attributesBuilder.addAll(convertToExpressions(resultingQuantifier)); + attributesBuilder.add(new Expression(atAlias, DataType.Primitives.NULLABLE_INTEGER.type(), oneBasedOrdinal) + .asEphemeral()); } final Expressions outputAttributes = Expressions.of(attributesBuilder.build()); @@ -351,9 +358,9 @@ private static LogicalOperator generateCorrelatedFieldAccess(@Nonnull Expression // - lookup("item.price", ..., matchQualifiedOnly=true) iterates [EphemeralExpression(item), item.b, item.c, ...] // - EphemeralExpression(item): exact match fails; lookupNestedField → skipped // - item.b: exact match item.b. - if (alias.isPresent() && atAlias.isEmpty() && flowedObjectType.isRecord()) { - final var elementType = DataTypeUtils.toRelationalType(flowedObjectType); - final var wholeStructExpr = new EphemeralExpression(alias, elementType, flowedObjectValue, + if (alias.isPresent() && atAlias.isEmpty() && elementType.isRecord()) { + final var structType = DataTypeUtils.toRelationalType(elementType); + final var wholeStructExpr = new EphemeralExpression(alias, structType, elementValue, Expression.Visibility.VISIBLE); return operator.withOutput(Expressions.of(ImmutableList.builder() .add(wholeStructExpr) @@ -365,15 +372,23 @@ private static LogicalOperator generateCorrelatedFieldAccess(@Nonnull Expression @Nonnull public static Expressions convertToExpressions(@Nonnull Quantifier quantifier) { + return convertToExpressions(quantifier.getFlowedObjectValue()); + } + + /** + * Expands a record-typed value into one {@link Expression} per field, each navigating into the value by ordinal. + * Used both for a quantifier's own flow and for a value reached inside it -- an {@link ExplodeExpression} wraps the + * array element in a struct, so its columns hang off {@code _0} rather than off the quantifier. + */ + @Nonnull + public static Expressions convertToExpressions(@Nonnull Value recordValue) { final ImmutableList.Builder attributesBuilder = ImmutableList.builder(); int colCount = 0; - final var columns = quantifier.getFlowedColumns(); - for (final var column : columns) { - final var field = column.getField(); - final var value = column.getValue(); + final var fields = Assert.castUnchecked(recordValue.getResultType(), Type.Record.class).getFields(); + for (final var field : fields) { final var attributeName = field.getFieldNameOptional().map(Identifier::of); - final var attributeType = DataTypeUtils.toRelationalType(value.getResultType()); - final var attributeExpression = FieldValue.ofOrdinalNumber(quantifier.getFlowedObjectValue(), colCount); + final var attributeType = DataTypeUtils.toRelationalType(field.getFieldType()); + final var attributeExpression = FieldValue.ofOrdinalNumber(recordValue, colCount); attributesBuilder.add(new Expression(attributeName, attributeType, attributeExpression)); colCount++; } diff --git a/fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/SemanticAnalyzer.java b/fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/SemanticAnalyzer.java index c4efe56ed62..a81b088539f 100644 --- a/fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/SemanticAnalyzer.java +++ b/fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/SemanticAnalyzer.java @@ -34,6 +34,7 @@ import com.apple.foundationdb.record.query.plan.cascades.Reference; import com.apple.foundationdb.record.query.plan.cascades.expressions.RelationalExpression; import com.apple.foundationdb.record.query.plan.cascades.expressions.TableFunctionExpression; +import com.apple.foundationdb.record.query.plan.cascades.expressions.ExplodeExpression; import com.apple.foundationdb.record.query.plan.cascades.typing.Type; import com.apple.foundationdb.record.query.plan.cascades.typing.Typed; import com.apple.foundationdb.record.query.plan.cascades.values.AggregateValue; @@ -398,7 +399,7 @@ public Star expandStar(@Nullable Identifier qualifier, @Nonnull LogicalOperators if (qualifier == null) { final var expansion = forEachOperators.getExpressions().nonEphemeralVisible(); return Star.overQuantifiers(Optional.empty(), Streams.stream(forEachOperators).map(LogicalOperator::getQuantifier) - .map(Quantifier::getFlowedObjectValue).collect(ImmutableList.toImmutableList()), "unknown", expansion); + .map(SemanticAnalyzer::starValue).collect(ImmutableList.toImmutableList()), "unknown", expansion); } // Case 2: qualifying a table, e.g. SELECT T.* FROM T, R; @@ -409,10 +410,10 @@ public Star expandStar(@Nullable Identifier qualifier, @Nonnull LogicalOperators // Star can only be expanded on a record (struct) type. Examples of non-record qualifier types are scalars // (e.g., when unnesting a scalar array, as in `SELECT integer.* FROM T, T.integer_array AS integer`) // as well as VECTOR, ENUM, and UUID. - Assert.thatUnchecked(logicalTable.getQuantifier().getFlowedObjectType().isRecord(), + Assert.thatUnchecked(starValue(logicalTable.getQuantifier()).getResultType().isRecord(), ErrorCode.INVALID_COLUMN_REFERENCE, () -> String.format(Locale.ROOT, "attempt to expand non-struct column %s", qualifier)); - return Star.overQuantifier(optionalQualifier, logicalTable.getQuantifier().getFlowedObjectValue(), + return Star.overQuantifier(optionalQualifier, starValue(logicalTable.getQuantifier()), qualifier.getName(), logicalTable.getOutput().nonEphemeralVisible()); } @@ -434,6 +435,22 @@ public Star expandStar(@Nullable Identifier qualifier, @Nonnull LogicalOperators return Star.overQuantifier(optionalQualifier, expression.getUnderlying(), qualifier.getName(), expressions); } + /** + * The value a {@code *} stands for over the given quantifier. That is the value it flows, except under an + * unnesting: a star expands to the fields of the array element, so the element is what it stands for. The ordinal + * of an unnesting with ordinality is ephemeral and hence not part of the expansion. + * + * @param quantifier the quantifier a star is expanded over + * + * @return the value the star stands for + */ + @Nonnull + private static Value starValue(@Nonnull final Quantifier quantifier) { + return quantifier.getRangesOver().get() instanceof ExplodeExpression + ? ExplodeExpression.elementValueOf(quantifier) + : quantifier.getFlowedObjectValue(); + } + @Nonnull public Expression resolveIdentifier(@Nonnull Identifier identifier, @Nonnull LogicalPlanFragment planFragment) { diff --git a/fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/Star.java b/fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/Star.java index ea8d68bb512..7ddd08a572d 100644 --- a/fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/Star.java +++ b/fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/Star.java @@ -23,7 +23,6 @@ import com.apple.foundationdb.annotation.API; import com.apple.foundationdb.record.query.plan.cascades.values.ConstantObjectValue; import com.apple.foundationdb.record.query.plan.cascades.values.LiteralValue; -import com.apple.foundationdb.record.query.plan.cascades.values.QuantifiedObjectValue; import com.apple.foundationdb.record.query.plan.cascades.values.RecordConstructorValue; import com.apple.foundationdb.record.query.plan.cascades.values.Value; import com.apple.foundationdb.relational.api.exceptions.ErrorCode; @@ -139,10 +138,10 @@ public static Star overQuantifier(@Nonnull Optional qualifier, @Nonnull public static Star overQuantifiers(@Nonnull Optional qualifier, - @Nonnull List quantifiers, + @Nonnull List values, @Nonnull String typeName, @Nonnull Expressions expansion) { - final var underlyingStarType = quantifiers.size() == 1 ? quantifiers.get(0) : RecordConstructorValue.ofUnnamed(quantifiers); + final var underlyingStarType = values.size() == 1 ? values.get(0) : RecordConstructorValue.ofUnnamed(values); final var starType = createStarType(typeName, expansion); return new Star(qualifier, starType, ensureValueConsistentWithExpansion(underlyingStarType, expansion), expansion); } diff --git a/fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/ddl/QuantifierValues.java b/fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/ddl/QuantifierValues.java index e6af76484fe..5783479ea60 100644 --- a/fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/ddl/QuantifierValues.java +++ b/fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/ddl/QuantifierValues.java @@ -32,11 +32,14 @@ import com.apple.foundationdb.record.query.plan.cascades.values.QuantifiedObjectValue; import com.apple.foundationdb.record.query.plan.cascades.values.SimpleValueVisitor; import com.apple.foundationdb.record.query.plan.cascades.values.Value; +import com.apple.foundationdb.relational.api.exceptions.ErrorCode; import com.apple.foundationdb.relational.util.Assert; +import com.google.common.collect.Iterables; import javax.annotation.Nonnull; import java.util.ArrayList; import java.util.LinkedHashMap; +import java.util.LinkedHashSet; import java.util.List; import java.util.Map; import java.util.Objects; @@ -58,10 +61,19 @@ final class QuantifierValues { @Nonnull private final List explodes; + /** + * The quantifiers that range over an {@link ExplodeExpression}. Their values are reached through the explode's + * result struct, which has to be seen through when dereferencing. + */ + @Nonnull + private final Set explodedQuantifiers; + private QuantifierValues(@Nonnull final Map valuesByQuantifier, - @Nonnull final List explodes) { + @Nonnull final List explodes, + @Nonnull final Set explodedQuantifiers) { this.valuesByQuantifier = valuesByQuantifier; this.explodes = explodes; + this.explodedQuantifiers = explodedQuantifiers; } /** @@ -84,7 +96,8 @@ public List getExplodes() { @Nonnull public static QuantifierValues collect(@Nonnull final RelationalExpression expression) { final var collector = new Collector(); - return new QuantifierValues(collector.visit(expression), collector.explodes); + return new QuantifierValues(collector.visit(expression), collector.explodes, + collector.getExplodedQuantifiers()); } /** @@ -113,7 +126,13 @@ private final class Dereferencer implements SimpleValueVisitor { @Override public Value evaluateAtValue(@Nonnull final Value value, @Nonnull final List childResults) { // a leaf stands for itself - return childResults.isEmpty() ? value : value.withChildren(childResults); + if (childResults.isEmpty()) { + return value; + } + if (value instanceof FieldValue && rangesOverExplode(((FieldValue)value).getChild())) { + return unwrapElement((FieldValue)value, Iterables.getOnlyElement(childResults)); + } + return value.withChildren(childResults); } @Nonnull @@ -122,6 +141,28 @@ public Value visitQuantifiedObjectValue(@Nonnull final QuantifiedObjectValue ele // what a quantifier stands for may reference another return visit(Assert.notNullUnchecked(valuesByQuantifier.get(element.getAlias()))); } + + private boolean rangesOverExplode(@Nonnull final Value value) { + return value instanceof QuantifiedObjectValue + && explodedQuantifiers.contains(((QuantifiedObjectValue)value).getAlias()); + } + + /** + * Sees through the result struct of an explode. Since the quantifier stands for the collection being unnested + * rather than for the explode's result, {@code q._0} is an element of that collection and {@code q._0.F} is + * {@code «collection».F}: the accessor of the element is dropped, and the rest of the path stays as it is. + */ + @Nonnull + private Value unwrapElement(@Nonnull final FieldValue fieldValue, @Nonnull final Value collectionValue) { + final var accessors = fieldValue.getFieldPath().getFieldAccessors(); + Assert.thatUnchecked(accessors.get(0).getOrdinal() == ExplodeExpression.ELEMENT_ORDINAL, + ErrorCode.UNSUPPORTED_OPERATION, + "Unsupported index definition, cannot index the ordinal of an unnesting"); + final var elementPath = accessors.subList(1, accessors.size()); + return elementPath.isEmpty() + ? collectionValue + : FieldValue.ofFields(collectionValue, new FieldValue.FieldPath(elementPath)); + } } /** @@ -138,6 +179,14 @@ private static final class Collector implements SimpleExpressionVisitor explodes = new ArrayList<>(); + @Nonnull + private final Set explodedQuantifiers = new LinkedHashSet<>(); + + @Nonnull + public Set getExplodedQuantifiers() { + return explodedQuantifiers; + } + @Nonnull @Override public Map evaluateAtExpression(@Nonnull final RelationalExpression expression, @@ -146,9 +195,12 @@ public Map evaluateAtExpression(@Nonnull final Rel for (final var quantifier : expression.getQuantifiers()) { final var rangesOver = quantifier.getRangesOver().get(); // a quantifier over an explode stands for the collection being unnested, not for the explode's result - merged.put(quantifier.getAlias(), rangesOver instanceof ExplodeExpression - ? unnestedCollectionValue((ExplodeExpression)rangesOver) - : rangesOver.getResultValue()); + if (rangesOver instanceof ExplodeExpression) { + explodedQuantifiers.add(quantifier.getAlias()); + merged.put(quantifier.getAlias(), unnestedCollectionValue((ExplodeExpression)rangesOver)); + } else { + merged.put(quantifier.getAlias(), rangesOver.getResultValue()); + } } return merged; } diff --git a/fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/visitors/QueryVisitor.java b/fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/visitors/QueryVisitor.java index aa218e40f42..87171cede4d 100644 --- a/fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/visitors/QueryVisitor.java +++ b/fdb-relational-core/src/main/java/com/apple/foundationdb/relational/recordlayer/query/visitors/QueryVisitor.java @@ -254,6 +254,19 @@ private Optional conjoinExpressions(@Nullable Expression seed, return Optional.ofNullable(seed); } + /** + * Builds a quantifier ranging over the elements of {@code collectionValue}. An {@link ExplodeExpression} flows each + * element wrapped in an anonymous struct, so a select is layered on top of it to project the element itself. + */ + @Nonnull + private static Quantifier.ForEach explodeElements(@Nonnull final Value collectionValue) { + final var explodeQuantifier = Quantifier.forEach(Reference.initialOf(new ExplodeExpression(collectionValue))); + return Quantifier.forEach(Reference.initialOf(GraphExpansion.ofQuantifier(explodeQuantifier) + .seal() + .buildSelectWithResultValue(FieldValue.ofOrdinalNumber(explodeQuantifier.getFlowedObjectValue(), + ExplodeExpression.ELEMENT_ORDINAL)))); + } + @Nonnull @Override public LogicalOperator visitSimpleTable(@Nonnull RelationalParser.SimpleTableContext simpleTableContext) { @@ -265,8 +278,7 @@ public LogicalOperator visitSimpleTable(@Nonnull RelationalParser.SimpleTableCon // can be projected over exactly one output row (standard SQL semantics). final var dummyElement = Expression.fromUnderlying(LiteralValue.ofScalar(true)); final var arrayOfOne = getDelegate().resolveFunction("__internal_array", false, dummyElement); - final var explodeExpr = new ExplodeExpression(arrayOfOne.getUnderlying()); - final var syntheticQuantifier = Quantifier.forEach(Reference.initialOf(explodeExpr)); + final var syntheticQuantifier = explodeElements(arrayOfOne.getUnderlying()); getDelegate().getCurrentPlanFragment().setOperator(LogicalOperator.newUnnamedOperator(Expressions.empty(), syntheticQuantifier)); } @@ -731,8 +743,7 @@ public LogicalOperator visitInlineTableItem(@Nonnull RelationalParser.InlineTabl } final var arguments = Expressions.of(rowExpressionBuilder.build()).asList().toArray(new Expression[0]); final var arrayOfTuples = getDelegate().resolveFunction("__internal_array", false, arguments); - final var explodeExpression = new ExplodeExpression(arrayOfTuples.getUnderlying()); - final var resultingQuantifier = Quantifier.forEach(Reference.initialOf(explodeExpression)); + final var resultingQuantifier = explodeElements(arrayOfTuples.getUnderlying()); var output = Expressions.of(LogicalOperator.convertToExpressions(resultingQuantifier)); return typeMaybe == null ? LogicalOperator.newUnnamedOperator(output, resultingQuantifier) @@ -813,8 +824,7 @@ public LogicalOperator visitInsertStatementValueValues(@Nonnull RelationalParser } final var arguments = Expressions.of(insertTuples.build()).asList().toArray(new Expression[0]); final var arrayOfTuples = getDelegate().resolveFunction("__internal_array", false, arguments); - final var explodeExpression = new ExplodeExpression(arrayOfTuples.getUnderlying()); - final var resultingQuantifier = Quantifier.forEach(Reference.initialOf(explodeExpression)); + final var resultingQuantifier = explodeElements(arrayOfTuples.getUnderlying()); return LogicalOperator.newUnnamedOperator(Expressions.ofSingle(arrayOfTuples), resultingQuantifier); } diff --git a/yaml-tests/src/test/resources/array-join-at.metrics.binpb b/yaml-tests/src/test/resources/array-join-at.metrics.binpb index d914cd5199e..7ee6f4870be 100644 Binary files a/yaml-tests/src/test/resources/array-join-at.metrics.binpb and b/yaml-tests/src/test/resources/array-join-at.metrics.binpb differ diff --git a/yaml-tests/src/test/resources/array-join-at.metrics.yaml b/yaml-tests/src/test/resources/array-join-at.metrics.yaml index 98335285f09..d585a88b300 100644 --- a/yaml-tests/src/test/resources/array-join-at.metrics.yaml +++ b/yaml-tests/src/test/resources/array-join-at.metrics.yaml @@ -24,7 +24,7 @@ array-join-at: insert_new_count: 15 insert_reused_count: 0 - query: EXPLAIN SELECT "id", "at" FROM T1, T1."arr1" AT "at" - ref: array-join-at.yamsql:95 + ref: array-join-at.yamsql:108 explain: SCAN([IS T1]) | FLATMAP q0 -> { EXPLODE q0.arr1 WITH ORDINALITY AS q1 RETURN (q0.id AS id, q1._1 + 1 AS at) } task_count: 158 @@ -38,7 +38,7 @@ array-join-at: - query: EXPLAIN SELECT "subquery"."id" - 100 AS "id", "at", "val" FROM (SELECT "id" + 100 AS "id", "arr1" FROM T1) AS "subquery", "subquery"."arr1" AS "val" AT "at" - ref: array-join-at.yamsql:107 + ref: array-join-at.yamsql:120 explain: SCAN([IS T1]) | FLATMAP q0 -> { EXPLODE q0.arr1 WITH ORDINALITY AS q1 RETURN (q0.id + @c17 - @c17 AS id, q1._1 + 1 AS at, q1._0 AS val) } task_count: 183 @@ -51,21 +51,21 @@ array-join-at: insert_reused_count: 0 - query: EXPLAIN SELECT "values"."id", "val", "at" FROM VALUES (1, [101]), (2, [201, 202, 203]) AS "values" ("id", "arr"), "values"."arr" AS "val" AT "at" - ref: array-join-at.yamsql:118 + ref: array-join-at.yamsql:131 explain: EXPLODE array((@c11 AS id, array(@c14) AS arr), (@c19 AS id, array(@c22, - @c24, @c26) AS arr)) | FLATMAP q0 -> { EXPLODE q0.arr WITH ORDINALITY AS q1 - RETURN (q0.id AS id, q1._0 AS val, q1._1 + 1 AS at) } - task_count: 236 - task_total_time_ms: 2 - transform_count: 70 - transform_time_ms: 0 - transform_yield_count: 14 - insert_time_ms: 0 - insert_new_count: 24 + @c24, @c26) AS arr)) | FLATMAP q0 -> { EXPLODE q0._0.arr WITH ORDINALITY AS + q1 RETURN (q0._0.id AS id, q1._0 AS val, q1._1 + 1 AS at) } + task_count: 261 + task_total_time_ms: 21 + transform_count: 75 + transform_time_ms: 7 + transform_yield_count: 16 + insert_time_ms: 1 + insert_new_count: 31 insert_reused_count: 0 - query: EXPLAIN SELECT "id", "at" + 10 AS "at_plus_10" FROM T1, T1."arr1" AS "val" AT "at" - ref: array-join-at.yamsql:143 + ref: array-join-at.yamsql:156 explain: SCAN([IS T1]) | FLATMAP q0 -> { EXPLODE q0.arr1 WITH ORDINALITY AS q1 RETURN (q0.id AS id, q1._1 + 1 + @c5 AS at_plus_10) } task_count: 158 @@ -78,7 +78,7 @@ array-join-at: insert_reused_count: 0 - query: EXPLAIN SELECT "id", "val", "at" FROM T1, T1."arr1_nn" AS "val" AT "at" WHERE "val" > 201 - ref: array-join-at.yamsql:154 + ref: array-join-at.yamsql:167 explain: SCAN([IS T1]) | FLATMAP q0 -> { EXPLODE q0.arr1_nn WITH ORDINALITY | FILTER _._0 GREATER_THAN promote(@c19 AS INT) AS q1 RETURN (q0.id AS id, q1._0 AS val, q1._1 + 1 AS at) } @@ -92,7 +92,7 @@ array-join-at: insert_reused_count: 1 - query: EXPLAIN SELECT "id", "val", "at" FROM T1, T1."arr1_nn" AS "val" AT "at" WHERE "at" + 1 = 3 - ref: array-join-at.yamsql:162 + ref: array-join-at.yamsql:175 explain: SCAN([IS T1]) | FLATMAP q0 -> { EXPLODE q0.arr1_nn WITH ORDINALITY | FILTER _._1 + 1 + @c19 EQUALS promote(@c21 AS INT) AS q1 RETURN (q0.id AS id, q1._0 AS val, q1._1 + 1 AS at) } @@ -106,7 +106,7 @@ array-join-at: insert_reused_count: 1 - query: EXPLAIN SELECT T2."id", "at1", "val1", "at2", "val2" FROM T2, T2."arr1" AS "val1" AT "at1", T2."arr2" AS "val2" AT "at2" - ref: array-join-at.yamsql:176 + ref: array-join-at.yamsql:189 explain: SCAN([IS T2]) | FLATMAP q0 -> { EXPLODE q0.arr1 WITH ORDINALITY | FLATMAP q1 -> { EXPLODE q0.arr2 WITH ORDINALITY AS q2 RETURN (q1 AS _0, q2 AS _1) } AS q3 RETURN (q0.id AS id, q3._0._1 + 1 AS at1, q3._0._0 AS val1, q3._1._1 @@ -121,7 +121,7 @@ array-join-at: insert_reused_count: 0 - query: EXPLAIN SELECT T2."id", "val1", "at1", "val2", "at2" FROM T2, T2."arr1" AS "val1" AT "at1", T2."arr1" AS "val2" AT "at2" - ref: array-join-at.yamsql:188 + ref: array-join-at.yamsql:201 explain: SCAN([IS T2]) | FLATMAP q0 -> { EXPLODE q0.arr1 WITH ORDINALITY | FLATMAP q1 -> { EXPLODE q0.arr1 WITH ORDINALITY AS q2 RETURN (q1 AS _0, q2 AS _1) } AS q3 RETURN (q0.id AS id, q3._0._0 AS val1, q3._0._1 + 1 AS at1, q3._1._0 @@ -136,7 +136,7 @@ array-join-at: insert_reused_count: 1 - query: EXPLAIN SELECT "id", "at", "arr1_val", T1."arr1_nn"["at"] AS "arr1_nn_val" FROM T1, T1."arr1" AS "arr1_val" AT "at" - ref: array-join-at.yamsql:208 + ref: array-join-at.yamsql:221 explain: SCAN([IS T1]) | FLATMAP q0 -> { EXPLODE q0.arr1 WITH ORDINALITY AS q1 RETURN (q0.id AS id, q1._1 + 1 AS at, q1._0 AS arr1_val, q0.arr1_nn[q1._1 + 1] AS arr1_nn_val) } @@ -151,7 +151,7 @@ array-join-at: - query: EXPLAIN SELECT "id", "at", "val", "val2" FROM T1, T1."arr1" AS "val" AT "at", (SELECT "val2" FROM T1 AS "OtherT1", "OtherT1"."arr1_nn" AS "val2" AT "at2" WHERE "OtherT1"."id" = T1."id" AND "val2" = "val" ) AS "subquery" - ref: array-join-at.yamsql:225 + ref: array-join-at.yamsql:238 explain: SCAN([IS T1]) | FLATMAP q0 -> { SCAN([IS T1, EQUALS q0.id]) | FLATMAP q1 -> { EXPLODE q0.arr1 WITH ORDINALITY | FLATMAP q2 -> { EXPLODE q1.arr1_nn WITH ORDINALITY | FILTER _._0 EQUALS q2._0 AS q3 RETURN (q2 AS _0, q3 AS _1) @@ -167,10 +167,10 @@ array-join-at: insert_reused_count: 133 - query: EXPLAIN SELECT T2."id", "val1", "at1", "val2" FROM T2, T2."arr1" AS "val1" AT "at1", T2."arr2" AS "val2" - ref: array-join-at.yamsql:267 + ref: array-join-at.yamsql:280 explain: SCAN([IS T2]) | FLATMAP q0 -> { EXPLODE q0.arr2 | FLATMAP q1 -> { EXPLODE q0.arr1 WITH ORDINALITY AS q2 RETURN (q2 AS _0, q1 AS _1) } AS q3 RETURN (q0.id - AS id, q3._0._0 AS val1, q3._0._1 + 1 AS at1, q3._1 AS val2) } + AS id, q3._0._0 AS val1, q3._0._1 + 1 AS at1, q3._1._0 AS val2) } task_count: 251 task_total_time_ms: 2 transform_count: 87 @@ -181,29 +181,30 @@ array-join-at: insert_reused_count: 0 - query: EXPLAIN SELECT "id", "val", "at" FROM T1, T1."arr1_nn" AS "val" AT "at" WHERE T1."id" IN (1, 2) - ref: array-join-at.yamsql:308 + ref: array-join-at.yamsql:321 explain: '[IN arrayDistinct(promote(@c21 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS T1, EQUALS q0]) | FLATMAP q1 -> { EXPLODE q1.arr1_nn WITH ORDINALITY AS q2 RETURN (q1.id AS id, q2._0 AS val, q2._1 + 1 AS at) } }' task_count: 1162 - task_total_time_ms: 14 + task_total_time_ms: 43 transform_count: 452 - transform_time_ms: 5 + transform_time_ms: 18 transform_yield_count: 68 - insert_time_ms: 0 - insert_new_count: 140 + insert_time_ms: 3 + insert_new_count: 143 insert_reused_count: 9 - query: EXPLAIN SELECT "id", "val", "at" FROM T1, T1."arr1_nn" AS "val" AT "at" WHERE "at" IN (1, 2) - ref: array-join-at.yamsql:320 - explain: SCAN([IS T1]) | FLATMAP q0 -> { EXPLODE q0.arr1_nn WITH ORDINALITY | - FILTER _._1 + 1 IN @c19 AS q1 RETURN (q0.id AS id, q1._0 AS val, q1._1 + 1 - AS at) } + ref: array-join-at.yamsql:333 + explain: EXPLODE arrayDistinct(@c19) | FLATMAP q0 -> { SCAN([IS T1]) | FLATMAP + q1 -> { EXPLODE q1.arr1_nn WITH ORDINALITY | FILTER _._1 + 1 EQUALS q0._0 + AS q2 RETURN (q1.id AS id, q2._0 AS val, q2._1 + 1 AS at) } AS q3 RETURN q3 + } task_count: 1045 task_total_time_ms: 27 transform_count: 420 transform_time_ms: 10 transform_yield_count: 51 insert_time_ms: 2 - insert_new_count: 114 + insert_new_count: 116 insert_reused_count: 6 diff --git a/yaml-tests/src/test/resources/array-join-at.yamsql b/yaml-tests/src/test/resources/array-join-at.yamsql index e8e39e0cfd3..19ecf6c47f4 100644 --- a/yaml-tests/src/test/resources/array-join-at.yamsql +++ b/yaml-tests/src/test/resources/array-join-at.yamsql @@ -43,7 +43,7 @@ test_block: tests: - # Normal unnesting (aka. array join) without AT on a nullable array. - query: SELECT "id", "val" FROM T1, T1."arr1" AS "val" ORDER BY "id" - - explain: "SCAN([IS T1]) | FLATMAP q0 -> { EXPLODE q0.arr1 AS q1 RETURN (q0.id AS id, q1 AS val) }" + - explain: "SCAN([IS T1]) | FLATMAP q0 -> { EXPLODE q0.arr1 AS q1 RETURN (q0.id AS id, q1._0 AS val) }" # ^ Notice the absence of WITH ORDINALITY here. - unorderedResult: [ {id: 1, val: 101}, @@ -80,8 +80,21 @@ test_block: {id: 2, val: 202, at: 2}, {id: 2, val: 203, at: 3}] - - # With `SELECT *`, the star expansion includes both the AS field and the AT field. + # `SELECT *` expands to the array elements only. The AT ordinal is a property of the unnesting rather than a + # column of the row, so it takes naming it to select it. + - query: SELECT * FROM T1, T1."arr1" AS "val" AT "at" + - resultMetadata: [{id: BIGINT}, {arr1: ARRAY(INTEGER)}, {arr1_nn: ARRAY(INTEGER)}, {val: INTEGER}] + - unorderedResult: [ + {id: 1, arr1: [101], arr1_nn: [101], val: 101}, + {id: 2, arr1: [201, 202, 203], arr1_nn: [201, 202, 203], val: 201}, + {id: 2, arr1: [201, 202, 203], arr1_nn: [201, 202, 203], val: 202}, + {id: 2, arr1: [201, 202, 203], arr1_nn: [201, 202, 203], val: 203}] + - + # ... so a star does not carry the ordinal out of a subquery, while naming it does. - query: SELECT "id", "val", "at" FROM (SELECT * FROM T1, T1."arr1" AS "val" AT "at") AS subquery + - error: UNDEFINED_COLUMN + - + - query: SELECT "id", "val", "at" FROM (SELECT "id", "val", "at" FROM T1, T1."arr1" AS "val" AT "at") AS subquery - unorderedResult: [ {id: 1, val: 101, at: 1}, {id: 2, val: 201, at: 1}, @@ -115,7 +128,7 @@ test_block: - query: SELECT "values"."id", "val", "at" FROM VALUES (1, [101]), (2, [201, 202, 203]) AS "values" ("id", "arr"), "values"."arr" AS "val" AT "at" - - explain: "EXPLODE array((@c11 AS id, array(@c14) AS arr), (@c19 AS id, array(@c22, @c24, @c26) AS arr)) | FLATMAP q0 -> { EXPLODE q0.arr WITH ORDINALITY AS q1 RETURN (q0.id AS id, q1._0 AS val, q1._1 + 1 AS at) }" + - explain: "EXPLODE array((@c11 AS id, array(@c14) AS arr), (@c19 AS id, array(@c22, @c24, @c26) AS arr)) | FLATMAP q0 -> { EXPLODE q0._0.arr WITH ORDINALITY AS q1 RETURN (q0._0.id AS id, q1._0 AS val, q1._1 + 1 AS at) }" - unorderedResult: [ {id: 1, val: 101, at: 1}, {id: 2, val: 201, at: 1}, @@ -264,7 +277,7 @@ test_block: FROM T2, T2."arr1" AS "val1" AT "at1", T2."arr2" AS "val2" - - explain: "SCAN([IS T2]) | FLATMAP q0 -> { EXPLODE q0.arr2 | FLATMAP q1 -> { EXPLODE q0.arr1 WITH ORDINALITY AS q2 RETURN (q2 AS _0, q1 AS _1) } AS q3 RETURN (q0.id AS id, q3._0._0 AS val1, q3._0._1 + 1 AS at1, q3._1 AS val2) }" + - explain: "SCAN([IS T2]) | FLATMAP q0 -> { EXPLODE q0.arr2 | FLATMAP q1 -> { EXPLODE q0.arr1 WITH ORDINALITY AS q2 RETURN (q2 AS _0, q1 AS _1) } AS q3 RETURN (q0.id AS id, q3._0._0 AS val1, q3._0._1 + 1 AS at1, q3._1._0 AS val2) }" - unorderedResult: [ {id: 1, val1: 110, at1: 1, val2: 120}, {id: 1, val1: 110, at1: 1, val2: 121}, @@ -317,7 +330,7 @@ test_block: - query: SELECT "id", "val", "at" FROM T1, T1."arr1_nn" AS "val" AT "at" WHERE "at" IN (1, 2) - - explain: "SCAN([IS T1]) | FLATMAP q0 -> { EXPLODE q0.arr1_nn WITH ORDINALITY | FILTER _._1 + 1 IN @c19 AS q1 RETURN (q0.id AS id, q1._0 AS val, q1._1 + 1 AS at) }" + - explain: "EXPLODE arrayDistinct(@c19) | FLATMAP q0 -> { SCAN([IS T1]) | FLATMAP q1 -> { EXPLODE q1.arr1_nn WITH ORDINALITY | FILTER _._1 + 1 EQUALS q0._0 AS q2 RETURN (q1.id AS id, q2._0 AS val, q2._1 + 1 AS at) } AS q3 RETURN q3 }" - resultMetadata: [{id: BIGINT}, {val: INTEGER}, {at: INTEGER}] - unorderedResult: [ {id: 1, val: 101, at: 1}, diff --git a/yaml-tests/src/test/resources/arrays-unnesting.metrics.binpb b/yaml-tests/src/test/resources/arrays-unnesting.metrics.binpb index c24d461f05e..dfb0e60050a 100644 Binary files a/yaml-tests/src/test/resources/arrays-unnesting.metrics.binpb and b/yaml-tests/src/test/resources/arrays-unnesting.metrics.binpb differ diff --git a/yaml-tests/src/test/resources/arrays-unnesting.metrics.yaml b/yaml-tests/src/test/resources/arrays-unnesting.metrics.yaml index 679c1daeebf..346a699cd89 100644 --- a/yaml-tests/src/test/resources/arrays-unnesting.metrics.yaml +++ b/yaml-tests/src/test/resources/arrays-unnesting.metrics.yaml @@ -36,12 +36,12 @@ unnamed-3: "item" ref: arrays-unnesting.yamsql:114 explain: SCAN([IS T1_indexed]) | FLATMAP q0 -> { EXPLODE q0.items AS q1 RETURN - (q0.id AS id, q1 AS item) } - task_count: 168 - task_total_time_ms: 5 - transform_count: 55 - transform_time_ms: 2 - transform_yield_count: 18 + (q0.id AS id, q1._0 AS item) } + task_count: 166 + task_total_time_ms: 102 + transform_count: 52 + transform_time_ms: 80 + transform_yield_count: 17 insert_time_ms: 0 insert_new_count: 15 insert_reused_count: 0 @@ -49,12 +49,12 @@ unnamed-3: FROM "row"."items" AS "item") AS SQ ref: arrays-unnesting.yamsql:130 explain: SCAN([IS T1_indexed]) | FLATMAP q0 -> { EXPLODE q0.items AS q1 RETURN - (q0.id AS id, q1 AS item) } - task_count: 193 - task_total_time_ms: 7 - transform_count: 60 - transform_time_ms: 2 - transform_yield_count: 20 - insert_time_ms: 0 + (q0.id AS id, q1._0 AS item) } + task_count: 191 + task_total_time_ms: 30 + transform_count: 57 + transform_time_ms: 13 + transform_yield_count: 19 + insert_time_ms: 1 insert_new_count: 20 insert_reused_count: 0 diff --git a/yaml-tests/src/test/resources/arrays-unnesting.yamsql b/yaml-tests/src/test/resources/arrays-unnesting.yamsql index d92ce77a92b..1e08ec7c97b 100644 --- a/yaml-tests/src/test/resources/arrays-unnesting.yamsql +++ b/yaml-tests/src/test/resources/arrays-unnesting.yamsql @@ -111,7 +111,7 @@ test_block: - # Unnesting the array using PartiQL-style unnesting. - query: SELECT "id", "item" FROM "T1_indexed" AS "row", "row"."items" AS "item" - - explain: "SCAN([IS T1_indexed]) | FLATMAP q0 -> { EXPLODE q0.items AS q1 RETURN (q0.id AS id, q1 AS item) }" + - explain: "SCAN([IS T1_indexed]) | FLATMAP q0 -> { EXPLODE q0.items AS q1 RETURN (q0.id AS id, q1._0 AS item) }" - unorderedResult: [ {id: 1, item: 'a'}, {id: 1, item: 'b'}, @@ -127,7 +127,7 @@ test_block: # Here the subquery packs each array item into a tuple, produces a stream of tuples, and binds SQ to each tuple. # The planner is able to produce the same EXPLODE plan as for PartiQL-style unnesting. - query: SELECT "id", SQ."item" FROM "T1_indexed" AS "row", (SELECT "item" FROM "row"."items" AS "item") AS SQ - - explain: "SCAN([IS T1_indexed]) | FLATMAP q0 -> { EXPLODE q0.items AS q1 RETURN (q0.id AS id, q1 AS item) }" + - explain: "SCAN([IS T1_indexed]) | FLATMAP q0 -> { EXPLODE q0.items AS q1 RETURN (q0.id AS id, q1._0 AS item) }" - unorderedResult: [ {id: 1, item: 'a'}, {id: 1, item: 'b'}, diff --git a/yaml-tests/src/test/resources/cast-tests.metrics.binpb b/yaml-tests/src/test/resources/cast-tests.metrics.binpb index a56d4768280..a01c44f25f5 100644 --- a/yaml-tests/src/test/resources/cast-tests.metrics.binpb +++ b/yaml-tests/src/test/resources/cast-tests.metrics.binpb @@ -309,105 +309,106 @@ Z 5 -> 4 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -}À +}Ç æ -cast-operator-testsÎEXPLAIN select cast(null as integer) as a, cast(null as bigint) as b, cast(null as string) as c, cast(null as double) as d, cast(null as boolean) as e, cast(null as string) as f from values (1), (2) as X(X)Ô -r«¡( Ô©(0ˆ–8 @pEXPLODE array((@c57 AS X), (@c61 AS X)) | MAP (NULL AS A, NULL AS B, NULL AS C, NULL AS D, NULL AS E, NULL AS F)Çdigraph G { +cast-operator-testsÎEXPLAIN select cast(null as integer) as a, cast(null as bigint) as b, cast(null as string) as c, cast(null as double) as d, cast(null as boolean) as e, cast(null as string) as f from values (1), (2) as X(X)Û +‰üï= Å¿ (0Þ�8 @pEXPLODE array((@c57 AS X), (@c61 AS X)) | MAP (NULL AS A, NULL AS B, NULL AS C, NULL AS D, NULL AS E, NULL AS F)Ídigraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Value Computation
MAP (NULL AS A, NULL AS B, NULL AS C, NULL AS D, NULL AS E, NULL AS F)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS A, LONG AS B, STRING AS C, DOUBLE AS D, BOOLEAN AS E, STRING AS F)" ]; - 2 [ label=<
Value Computation
EXPLODE array((@c57 AS X), (@c61 AS X))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X)" ]; + 2 [ label=<
Value Computation
EXPLODE array((@c57 AS X), (@c61 AS X))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X AS _0)" ]; 2 -> 1 [ label=< q0> label="q0" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -}„ +}‹ U -cast-operator-tests>EXPLAIN select cast(null as uuid) from values (1), (2) as X(X)ª -r²¬1 ïŒ(0ª…8 @:EXPLODE array((@c10 AS X), (@c14 AS X)) | MAP (NULL AS _0)Ódigraph G { +cast-operator-tests>EXPLAIN select cast(null as uuid) from values (1), (2) as X(X)± +‰žß> Û• (0Ó¼8 @:EXPLODE array((@c10 AS X), (@c14 AS X)) | MAP (NULL AS _0)Ùdigraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Value Computation
MAP (NULL AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(UUID AS _0)" ]; - 2 [ label=<
Value Computation
EXPLODE array((@c10 AS X), (@c14 AS X))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X)" ]; + 2 [ label=<
Value Computation
EXPLODE array((@c10 AS X), (@c14 AS X))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X AS _0)" ]; 2 -> 1 [ label=< q0> label="q0" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -}† +}� V -cast-operator-tests?EXPLAIN select cast(null as float) from values (1), (2) as X(X)« -rƉ' ¹°(0““8 @:EXPLODE array((@c10 AS X), (@c14 AS X)) | MAP (NULL AS _0)Ôdigraph G { +cast-operator-tests?EXPLAIN select cast(null as float) from values (1), (2) as X(X)² +‰£Ó3 ˰(0†ç8 @:EXPLODE array((@c10 AS X), (@c14 AS X)) | MAP (NULL AS _0)Údigraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Value Computation
MAP (NULL AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(FLOAT AS _0)" ]; - 2 [ label=<
Value Computation
EXPLODE array((@c10 AS X), (@c14 AS X))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X)" ]; + 2 [ label=<
Value Computation
EXPLODE array((@c10 AS X), (@c14 AS X))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X AS _0)" ]; 2 -> 1 [ label=< q0> label="q0" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -}† +}� V -cast-operator-tests?EXPLAIN select cast(null as bytes) from values (1), (2) as X(X)« -r¡±- »¯(0®³8 @:EXPLODE array((@c10 AS X), (@c14 AS X)) | MAP (NULL AS _0)Ôdigraph G { +cast-operator-tests?EXPLAIN select cast(null as bytes) from values (1), (2) as X(X)² +‰›ç7 ¯à (0ß«8 @:EXPLODE array((@c10 AS X), (@c14 AS X)) | MAP (NULL AS _0)Údigraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Value Computation
MAP (NULL AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(BYTES AS _0)" ]; - 2 [ label=<
Value Computation
EXPLODE array((@c10 AS X), (@c14 AS X))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X)" ]; + 2 [ label=<
Value Computation
EXPLODE array((@c10 AS X), (@c14 AS X))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X AS _0)" ]; 2 -> 1 [ label=< q0> label="q0" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -}Á +}È ´ -cast-operator-testsœEXPLAIN select cast(null as vector(10, half)) as a, cast(null as vector(15, float)) as b, cast(null as vector(30, double)) as c from values (1), (2) as X(X)‡ -ròœ+ °Þ(0�¸8 @OEXPLODE array((@c45 AS X), (@c49 AS X)) | MAP (NULL AS A, NULL AS B, NULL AS C)›digraph G { +cast-operator-testsœEXPLAIN select cast(null as vector(10, half)) as a, cast(null as vector(15, float)) as b, cast(null as vector(30, double)) as c from values (1), (2) as X(X)Ž +‰…�< ¾� (0ŒÆ8 @OEXPLODE array((@c45 AS X), (@c49 AS X)) | MAP (NULL AS A, NULL AS B, NULL AS C)¡digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Value Computation
MAP (NULL AS A, NULL AS B, NULL AS C)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(VECTOR(16, 10) AS A, VECTOR(32, 15) AS B, VECTOR(64, 30) AS C)" ]; - 2 [ label=<
Value Computation
EXPLODE array((@c45 AS X), (@c49 AS X))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X)" ]; + 2 [ label=<
Value Computation
EXPLODE array((@c45 AS X), (@c49 AS X))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X AS _0)" ]; 2 -> 1 [ label=< q0> label="q0" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -}Ž +}• Š -cast-operator-testsòEXPLAIN select cast(null as integer array) as a, cast(null as bigint array) as b, cast(null as string array) as c, cast(null as double array) as d, cast(null as boolean array) as e, cast(null as string array) as f from values (1), (2) as X(X)þ -r»’+ ãÚ(0é 8 @pEXPLODE array((@c63 AS X), (@c67 AS X)) | MAP (NULL AS A, NULL AS B, NULL AS C, NULL AS D, NULL AS E, NULL AS F)ñdigraph G { +cast-operator-testsòEXPLAIN select cast(null as integer array) as a, cast(null as bigint array) as b, cast(null as string array) as c, cast(null as double array) as d, cast(null as boolean array) as e, cast(null as string array) as f from values (1), (2) as X(X)… +‰ÚÂA æÈ (0Öæ8 @pEXPLODE array((@c63 AS X), (@c67 AS X)) | MAP (NULL AS A, NULL AS B, NULL AS C, NULL AS D, NULL AS E, NULL AS F)÷digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Value Computation
MAP (NULL AS A, NULL AS B, NULL AS C, NULL AS D, NULL AS E, NULL AS F)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(ARRAY(INT) AS A, ARRAY(LONG) AS B, ARRAY(STRING) AS C, ARRAY(DOUBLE) AS D, ARRAY(BOOLEAN) AS E, ARRAY(STRING) AS F)" ]; - 2 [ label=<
Value Computation
EXPLODE array((@c63 AS X), (@c67 AS X))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X)" ]; + 2 [ label=<
Value Computation
EXPLODE array((@c63 AS X), (@c67 AS X))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X AS _0)" ]; 2 -> 1 [ label=< q0> label="q0" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -}‘ +}˜ [ -cast-operator-testsDEXPLAIN select cast(null as uuid array) from values (1), (2) as X(X)± -r¡”$ §€(0™ƒ8 @:EXPLODE array((@c11 AS X), (@c15 AS X)) | MAP (NULL AS _0)Údigraph G { +cast-operator-testsDEXPLAIN select cast(null as uuid array) from values (1), (2) as X(X)¸ +‰óÛ6 Þà (0­ 8 @:EXPLODE array((@c11 AS X), (@c15 AS X)) | MAP (NULL AS _0)àdigraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Value Computation
MAP (NULL AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(ARRAY(UUID) AS _0)" ]; - 2 [ label=<
Value Computation
EXPLODE array((@c11 AS X), (@c15 AS X))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X)" ]; + 2 [ label=<
Value Computation
EXPLODE array((@c11 AS X), (@c15 AS X))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X AS _0)" ]; 2 -> 1 [ label=< q0> label="q0" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -}“ +}š \ -cast-operator-testsEEXPLAIN select cast(null as float array) from values (1), (2) as X(X)² -r®«  ÞŒ(0‡‰8 @:EXPLODE array((@c11 AS X), (@c15 AS X)) | MAP (NULL AS _0)Ûdigraph G { +cast-operator-testsEEXPLAIN select cast(null as float array) from values (1), (2) as X(X)¹ +‰ÎÔ3  Ì(0öù8 @:EXPLODE array((@c11 AS X), (@c15 AS X)) | MAP (NULL AS _0)ádigraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Value Computation
MAP (NULL AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(ARRAY(FLOAT) AS _0)" ]; - 2 [ label=<
Value Computation
EXPLODE array((@c11 AS X), (@c15 AS X))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X)" ]; + 2 [ label=<
Value Computation
EXPLODE array((@c11 AS X), (@c15 AS X))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X AS _0)" ]; 2 -> 1 [ label=< q0> label="q0" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -}“ +}š \ -cast-operator-testsEEXPLAIN select cast(null as bytes array) from values (1), (2) as X(X)² -rø¤# åÝ(0ÉŽ8 @:EXPLODE array((@c11 AS X), (@c15 AS X)) | MAP (NULL AS _0)Ûdigraph G { +cast-operator-testsEEXPLAIN select cast(null as bytes array) from values (1), (2) as X(X)¹ +‰÷Þ4 Òæ(0‰ô8 @:EXPLODE array((@c11 AS X), (@c15 AS X)) | MAP (NULL AS _0)ádigraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Value Computation
MAP (NULL AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(ARRAY(BYTES) AS _0)" ]; - 2 [ label=<
Value Computation
EXPLODE array((@c11 AS X), (@c15 AS X))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X)" ]; + 2 [ label=<
Value Computation
EXPLODE array((@c11 AS X), (@c15 AS X))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X AS _0)" ]; 2 -> 1 [ label=< q0> label="q0" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -}è +}ï Æ -cast-operator-tests®EXPLAIN select cast(null as vector(10, half) array) as a, cast(null as vector(15, float) array) as b, cast(null as vector(30, double) array) as c from values (1), (2) as X(X)œ -ríØ% Ú¸(0ï�8 @OEXPLODE array((@c48 AS X), (@c52 AS X)) | MAP (NULL AS A, NULL AS B, NULL AS C)°digraph G { +cast-operator-tests®EXPLAIN select cast(null as vector(10, half) array) as a, cast(null as vector(15, float) array) as b, cast(null as vector(30, double) array) as c from values (1), (2) as X(X)£ +‰ ÷: Áå +(0æ¨8 @OEXPLODE array((@c48 AS X), (@c52 AS X)) | MAP (NULL AS A, NULL AS B, NULL AS C)¶digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Value Computation
MAP (NULL AS A, NULL AS B, NULL AS C)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(ARRAY(VECTOR(16, 10)) AS A, ARRAY(VECTOR(32, 15)) AS B, ARRAY(VECTOR(64, 30)) AS C)" ]; - 2 [ label=<
Value Computation
EXPLODE array((@c48 AS X), (@c52 AS X))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X)" ]; + 2 [ label=<
Value Computation
EXPLODE array((@c48 AS X), (@c52 AS X))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS X AS _0)" ]; 2 -> 1 [ label=< q0> label="q0" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; } \ No newline at end of file diff --git a/yaml-tests/src/test/resources/cast-tests.metrics.yaml b/yaml-tests/src/test/resources/cast-tests.metrics.yaml index 4b44165daca..315e19927d2 100644 --- a/yaml-tests/src/test/resources/cast-tests.metrics.yaml +++ b/yaml-tests/src/test/resources/cast-tests.metrics.yaml @@ -325,46 +325,46 @@ cast-operator-tests: ref: cast-tests.yamsql:184 explain: EXPLODE array((@c57 AS X), (@c61 AS X)) | MAP (NULL AS A, NULL AS B, NULL AS C, NULL AS D, NULL AS E, NULL AS F) - task_count: 114 - task_total_time_ms: 0 - transform_count: 27 + task_count: 137 + task_total_time_ms: 1 + transform_count: 32 transform_time_ms: 0 - transform_yield_count: 6 + transform_yield_count: 8 insert_time_ms: 0 - insert_new_count: 9 + insert_new_count: 13 insert_reused_count: 0 - query: EXPLAIN select cast(null as uuid) from values (1), (2) as X(X) ref: cast-tests.yamsql:196 explain: EXPLODE array((@c10 AS X), (@c14 AS X)) | MAP (NULL AS _0) - task_count: 114 - task_total_time_ms: 0 - transform_count: 27 + task_count: 137 + task_total_time_ms: 1 + transform_count: 32 transform_time_ms: 0 - transform_yield_count: 6 + transform_yield_count: 8 insert_time_ms: 0 - insert_new_count: 9 + insert_new_count: 13 insert_reused_count: 0 - query: EXPLAIN select cast(null as float) from values (1), (2) as X(X) ref: cast-tests.yamsql:205 explain: EXPLODE array((@c10 AS X), (@c14 AS X)) | MAP (NULL AS _0) - task_count: 114 + task_count: 137 task_total_time_ms: 0 - transform_count: 27 + transform_count: 32 transform_time_ms: 0 - transform_yield_count: 6 + transform_yield_count: 8 insert_time_ms: 0 - insert_new_count: 9 + insert_new_count: 13 insert_reused_count: 0 - query: EXPLAIN select cast(null as bytes) from values (1), (2) as X(X) ref: cast-tests.yamsql:211 explain: EXPLODE array((@c10 AS X), (@c14 AS X)) | MAP (NULL AS _0) - task_count: 114 + task_count: 137 task_total_time_ms: 0 - transform_count: 27 + transform_count: 32 transform_time_ms: 0 - transform_yield_count: 6 + transform_yield_count: 8 insert_time_ms: 0 - insert_new_count: 9 + insert_new_count: 13 insert_reused_count: 0 - query: EXPLAIN select cast(null as vector(10, half)) as a, cast(null as vector(15, float)) as b, cast(null as vector(30, double)) as c from values (1), (2) as @@ -372,13 +372,13 @@ cast-operator-tests: ref: cast-tests.yamsql:216 explain: EXPLODE array((@c45 AS X), (@c49 AS X)) | MAP (NULL AS A, NULL AS B, NULL AS C) - task_count: 114 + task_count: 137 task_total_time_ms: 0 - transform_count: 27 + transform_count: 32 transform_time_ms: 0 - transform_yield_count: 6 + transform_yield_count: 8 insert_time_ms: 0 - insert_new_count: 9 + insert_new_count: 13 insert_reused_count: 0 - query: EXPLAIN select cast(null as integer array) as a, cast(null as bigint array) as b, cast(null as string array) as c, cast(null as double array) as d, cast(null @@ -387,46 +387,46 @@ cast-operator-tests: ref: cast-tests.yamsql:223 explain: EXPLODE array((@c63 AS X), (@c67 AS X)) | MAP (NULL AS A, NULL AS B, NULL AS C, NULL AS D, NULL AS E, NULL AS F) - task_count: 114 - task_total_time_ms: 0 - transform_count: 27 + task_count: 137 + task_total_time_ms: 1 + transform_count: 32 transform_time_ms: 0 - transform_yield_count: 6 + transform_yield_count: 8 insert_time_ms: 0 - insert_new_count: 9 + insert_new_count: 13 insert_reused_count: 0 - query: EXPLAIN select cast(null as uuid array) from values (1), (2) as X(X) ref: cast-tests.yamsql:235 explain: EXPLODE array((@c11 AS X), (@c15 AS X)) | MAP (NULL AS _0) - task_count: 114 + task_count: 137 task_total_time_ms: 0 - transform_count: 27 + transform_count: 32 transform_time_ms: 0 - transform_yield_count: 6 + transform_yield_count: 8 insert_time_ms: 0 - insert_new_count: 9 + insert_new_count: 13 insert_reused_count: 0 - query: EXPLAIN select cast(null as float array) from values (1), (2) as X(X) ref: cast-tests.yamsql:243 explain: EXPLODE array((@c11 AS X), (@c15 AS X)) | MAP (NULL AS _0) - task_count: 114 + task_count: 137 task_total_time_ms: 0 - transform_count: 27 + transform_count: 32 transform_time_ms: 0 - transform_yield_count: 6 + transform_yield_count: 8 insert_time_ms: 0 - insert_new_count: 9 + insert_new_count: 13 insert_reused_count: 0 - query: EXPLAIN select cast(null as bytes array) from values (1), (2) as X(X) ref: cast-tests.yamsql:251 explain: EXPLODE array((@c11 AS X), (@c15 AS X)) | MAP (NULL AS _0) - task_count: 114 + task_count: 137 task_total_time_ms: 0 - transform_count: 27 + transform_count: 32 transform_time_ms: 0 - transform_yield_count: 6 + transform_yield_count: 8 insert_time_ms: 0 - insert_new_count: 9 + insert_new_count: 13 insert_reused_count: 0 - query: EXPLAIN select cast(null as vector(10, half) array) as a, cast(null as vector(15, float) array) as b, cast(null as vector(30, double) array) as c @@ -434,11 +434,11 @@ cast-operator-tests: ref: cast-tests.yamsql:258 explain: EXPLODE array((@c48 AS X), (@c52 AS X)) | MAP (NULL AS A, NULL AS B, NULL AS C) - task_count: 114 + task_count: 137 task_total_time_ms: 0 - transform_count: 27 + transform_count: 32 transform_time_ms: 0 - transform_yield_count: 6 + transform_yield_count: 8 insert_time_ms: 0 - insert_new_count: 9 + insert_new_count: 13 insert_reused_count: 0 diff --git a/yaml-tests/src/test/resources/in-predicate.metrics.binpb b/yaml-tests/src/test/resources/in-predicate.metrics.binpb index 96f90f2dd94..d15e02bd4c3 100644 --- a/yaml-tests/src/test/resources/in-predicate.metrics.binpb +++ b/yaml-tests/src/test/resources/in-predicate.metrics.binpb @@ -1,15 +1,15 @@ -ý +� @ - unnamed-23EXPLAIN select a, b from ta where b in (1, 3, 5, 7)¸ -« à»+¡ «ŽÏ (C0¥ßˆ8v@�ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) }†digraph G { + unnamed-23EXPLAIN select a, b from ta where b in (1, 3, 5, 7)Ê +«Ãñ¨2¡ ·«Ù (C0ˆ­›8x@’ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) }•digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.A AS A, q2.B AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B)" ]; 2 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 3 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; - 4 [ label=<
Predicate Filter
WHERE q2.B EQUALS q42
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; - 5 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; + 4 [ label=<
Predicate Filter
WHERE q2.B EQUALS q42._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 5 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ label=< q42> label="q42" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -22,18 +22,18 @@ rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}ô +}† 7 - unnamed-2*EXPLAIN select a, b from ta where b in (6)¸ -« à»+¡ «ŽÏ (C0¥ßˆ8v@�ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) }†digraph G { + unnamed-2*EXPLAIN select a, b from ta where b in (6)Ê +«Ãñ¨2¡ ·«Ù (C0ˆ­›8x@’ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) }•digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.A AS A, q2.B AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B)" ]; 2 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 3 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; - 4 [ label=<
Predicate Filter
WHERE q2.B EQUALS q42
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; - 5 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; + 4 [ label=<
Predicate Filter
WHERE q2.B EQUALS q42._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 5 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ label=< q42> label="q42" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -46,18 +46,18 @@ rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}ý +}� @ - unnamed-23EXPLAIN select a, b from ta where b in (10, 33, 66)¸ -« à»+¡ «ŽÏ (C0¥ßˆ8v@�ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) }†digraph G { + unnamed-23EXPLAIN select a, b from ta where b in (10, 33, 66)Ê +«Ãñ¨2¡ ·«Ù (C0ˆ­›8x@’ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) }•digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.A AS A, q2.B AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B)" ]; 2 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 3 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; - 4 [ label=<
Predicate Filter
WHERE q2.B EQUALS q42
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; - 5 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; + 4 [ label=<
Predicate Filter
WHERE q2.B EQUALS q42._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 5 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ label=< q42> label="q42" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -70,18 +70,19 @@ rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}Õ +}æ H - unnamed-2;EXPLAIN select a, b from ta where b in (1 + 0, 3 + 0, 5, 7)ˆ -«‘ö¯)¡ þ”Ð (C0–�‘8v@·ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(array(@c10 + @c12, @c14 + @c12, @c18, @c20) AS ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) }®digraph G { + unnamed-2;EXPLAIN select a, b from ta where b in (1 + 0, 3 + 0, 5, 7)™ +«ö†æ"¡ ²è× +(C0¬«|8x@ºISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(array(@c10 + @c12, @c14 + @c12, @c18, @c20) AS ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) }½digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.A AS A, q2.B AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B)" ]; 2 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 3 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; - 4 [ label=<
Predicate Filter
WHERE q2.B EQUALS q42
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; - 5 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(array(@c10 + @c12, @c14 + @c12, @c18, @c20) AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; + 4 [ label=<
Predicate Filter
WHERE q2.B EQUALS q42._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 5 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(array(@c10 + @c12, @c14 + @c12, @c18, @c20) AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ label=< q42> label="q42" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -94,18 +95,18 @@ H rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}ý +}� @ - unnamed-23EXPLAIN select a, b from ta where b in (1, 1, 1, 1)¸ -« à»+¡ «ŽÏ (C0¥ßˆ8v@�ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) }†digraph G { + unnamed-23EXPLAIN select a, b from ta where b in (1, 1, 1, 1)Ê +«Ãñ¨2¡ ·«Ù (C0ˆ­›8x@’ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) }•digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.A AS A, q2.B AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B)" ]; 2 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 3 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; - 4 [ label=<
Predicate Filter
WHERE q2.B EQUALS q42
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; - 5 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; + 4 [ label=<
Predicate Filter
WHERE q2.B EQUALS q42._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 5 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ label=< q42> label="q42" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -118,18 +119,18 @@ H rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}ý +}� @ - unnamed-23EXPLAIN select a, b from ta where b in (1, 2, 1, 3)¸ -« à»+¡ «ŽÏ (C0¥ßˆ8v@�ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) }†digraph G { + unnamed-23EXPLAIN select a, b from ta where b in (1, 2, 1, 3)Ê +«Ãñ¨2¡ ·«Ù (C0ˆ­›8x@’ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) }•digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.A AS A, q2.B AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B)" ]; 2 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 3 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; - 4 [ label=<
Predicate Filter
WHERE q2.B EQUALS q42
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; - 5 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; + 4 [ label=<
Predicate Filter
WHERE q2.B EQUALS q42._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 5 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ label=< q42> label="q42" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -142,18 +143,18 @@ H rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}ø +}‹ P - unnamed-2CEXPLAIN select a, b from ta where b in (1 + 0, 1 + 0, 1 + 0, 1 + 0)£ -«©ÎÎ#¡ êÞÀ (C0Š—y8v@ÅISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(array(@c10 + @c12, @c10 + @c12, @c10 + @c12, @c10 + @c12) AS ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) }¼digraph G { + unnamed-2CEXPLAIN select a, b from ta where b in (1 + 0, 1 + 0, 1 + 0, 1 + 0)¶ +«Ä™ô6¡ �Žç(C0篵8x@ÈISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(array(@c10 + @c12, @c10 + @c12, @c10 + @c12, @c10 + @c12) AS ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) }Ëdigraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.A AS A, q2.B AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B)" ]; 2 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 3 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; - 4 [ label=<
Predicate Filter
WHERE q2.B EQUALS q42
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; - 5 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(array(@c10 + @c12, @c10 + @c12, @c10 + @c12, @c10 + @c12) AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; + 4 [ label=<
Predicate Filter
WHERE q2.B EQUALS q42._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 5 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(array(@c10 + @c12, @c10 + @c12, @c10 + @c12, @c10 + @c12) AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ label=< q42> label="q42" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -166,18 +167,18 @@ P rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}¶ +}É B - unnamed-25EXPLAIN select a, b from ta where b in (1 + 0, 0 + 1)ï -«ûúÄ&¡ �¨… (C0®šx8v@«ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(array(@c10 + @c12, @c12 + @c10) AS ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) }¢digraph G { + unnamed-25EXPLAIN select a, b from ta where b in (1 + 0, 0 + 1)‚ +«‡¹®4¡ ìÓ¯(C0¢Â²8x@®ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(array(@c10 + @c12, @c12 + @c10) AS ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) }±digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.A AS A, q2.B AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B)" ]; 2 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 3 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; - 4 [ label=<
Predicate Filter
WHERE q2.B EQUALS q42
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; - 5 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(array(@c10 + @c12, @c12 + @c10) AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; + 4 [ label=<
Predicate Filter
WHERE q2.B EQUALS q42._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 5 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(array(@c10 + @c12, @c12 + @c10) AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ label=< q42> label="q42" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -190,19 +191,18 @@ B rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}× +}ê F - unnamed-29EXPLAIN select a, c from ta where c in (4.56, 3.45, 2.34)Œ -«—ܱ*¡ ÒÊŠ -(C0”À}8v@wISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.C EQUALS _ AS q1 RETURN (q0.A AS A, q0.C AS C) }ôdigraph G { + unnamed-29EXPLAIN select a, c from ta where c in (4.56, 3.45, 2.34)Ÿ +«„€û2¡ ñÞ¶(C0»‹¸8x@zISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.C EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.C AS C) }ƒdigraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.A AS A, q2.C AS C)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, DOUBLE AS C)" ]; 2 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 3 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; - 4 [ label=<
Predicate Filter
WHERE q2.C EQUALS q42
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE)" ]; - 5 [ label=<
Value Computation
EXPLODE arrayDistinct(@c9)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE)" ]; + 4 [ label=<
Predicate Filter
WHERE q2.C EQUALS q42._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE AS _0)" ]; + 5 [ label=<
Value Computation
EXPLODE arrayDistinct(@c9)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE AS _0)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ label=< q42> label="q42" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -215,19 +215,18 @@ F rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}Ë +}Þ : - unnamed-2-EXPLAIN select a, c from ta where c in (9.01)Œ -«—ܱ*¡ ÒÊŠ -(C0”À}8v@wISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.C EQUALS _ AS q1 RETURN (q0.A AS A, q0.C AS C) }ôdigraph G { + unnamed-2-EXPLAIN select a, c from ta where c in (9.01)Ÿ +«„€û2¡ ñÞ¶(C0»‹¸8x@zISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.C EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.C AS C) }ƒdigraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.A AS A, q2.C AS C)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, DOUBLE AS C)" ]; 2 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 3 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; - 4 [ label=<
Predicate Filter
WHERE q2.C EQUALS q42
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE)" ]; - 5 [ label=<
Value Computation
EXPLODE arrayDistinct(@c9)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE)" ]; + 4 [ label=<
Predicate Filter
WHERE q2.C EQUALS q42._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE AS _0)" ]; + 5 [ label=<
Value Computation
EXPLODE arrayDistinct(@c9)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE AS _0)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ label=< q42> label="q42" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -240,19 +239,18 @@ F rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}ï +}� > - unnamed-21EXPLAIN select a, c from ta where c in (3.01 + 6)¬ -«ñºµ-¡ õ»¼ -(C0¢Ö‹8v@†ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(array(@c10 + @c12)) | FILTER q0.C EQUALS _ AS q1 RETURN (q0.A AS A, q0.C AS C) }ƒdigraph G { + unnamed-21EXPLAIN select a, c from ta where c in (3.01 + 6)¾ +«Üêž0¡ ûíÞ (C0åÀ”8x@‰ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(array(@c10 + @c12)) | FILTER q0.C EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.C AS C) }’digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.A AS A, q2.C AS C)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, DOUBLE AS C)" ]; 2 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 3 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; - 4 [ label=<
Predicate Filter
WHERE q2.C EQUALS q42
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE)" ]; - 5 [ label=<
Value Computation
EXPLODE arrayDistinct(array(@c10 + @c12))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE)" ]; + 4 [ label=<
Predicate Filter
WHERE q2.C EQUALS q42._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE AS _0)" ]; + 5 [ label=<
Value Computation
EXPLODE arrayDistinct(array(@c10 + @c12))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(DOUBLE AS _0)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ label=< q42> label="q42" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -265,19 +263,18 @@ F rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}Ö +}è A - unnamed-24EXPLAIN select a, d from ta where d in (true, false)� -«ÔºÓ,¡ Ëý³ -(C0˜ÐŽ8v@wISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.D EQUALS _ AS q1 RETURN (q0.A AS A, q0.D AS D) }÷digraph G { + unnamed-24EXPLAIN select a, d from ta where d in (true, false)¢ +«‡�Î2¡ §Èå (C0�à¥8x@zISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.D EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.D AS D) }†digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.A AS A, q2.D AS D)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, BOOLEAN AS D)" ]; 2 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 3 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; - 4 [ label=<
Predicate Filter
WHERE q2.D EQUALS q42
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(BOOLEAN)" ]; - 5 [ label=<
Value Computation
EXPLODE arrayDistinct(@c9)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(BOOLEAN)" ]; + 4 [ label=<
Predicate Filter
WHERE q2.D EQUALS q42._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(BOOLEAN AS _0)" ]; + 5 [ label=<
Value Computation
EXPLODE arrayDistinct(@c9)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(BOOLEAN AS _0)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ label=< q42> label="q42" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -290,19 +287,18 @@ A rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}Ï +}á : - unnamed-2-EXPLAIN select a, d from ta where d in (true)� -«ÔºÓ,¡ Ëý³ -(C0˜ÐŽ8v@wISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.D EQUALS _ AS q1 RETURN (q0.A AS A, q0.D AS D) }÷digraph G { + unnamed-2-EXPLAIN select a, d from ta where d in (true)¢ +«‡�Î2¡ §Èå (C0�à¥8x@zISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.D EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.D AS D) }†digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.A AS A, q2.D AS D)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, BOOLEAN AS D)" ]; 2 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 3 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; - 4 [ label=<
Predicate Filter
WHERE q2.D EQUALS q42
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(BOOLEAN)" ]; - 5 [ label=<
Value Computation
EXPLODE arrayDistinct(@c9)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(BOOLEAN)" ]; + 4 [ label=<
Predicate Filter
WHERE q2.D EQUALS q42._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(BOOLEAN AS _0)" ]; + 5 [ label=<
Value Computation
EXPLODE arrayDistinct(@c9)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(BOOLEAN AS _0)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ label=< q42> label="q42" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -315,18 +311,18 @@ A rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}ð +}ƒ ; - unnamed-2.EXPLAIN select a, d from ta where d in (3 < 4)° -«–ã½$¡ ðë•(C0ÐŒu8v@‡ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(array(@c10 lt @c12)) | FILTER q0.D EQUALS _ AS q1 RETURN (q0.A AS A, q0.D AS D) }‡digraph G { + unnamed-2.EXPLAIN select a, d from ta where d in (3 < 4)à +«Š£Ç8¡ Éöû (C0žÕÇ8x@ŠISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(array(@c10 lt @c12)) | FILTER q0.D EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.D AS D) }–digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.A AS A, q2.D AS D)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, BOOLEAN AS D)" ]; 2 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 3 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; - 4 [ label=<
Predicate Filter
WHERE q2.D EQUALS q42
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(BOOLEAN)" ]; - 5 [ label=<
Value Computation
EXPLODE arrayDistinct(array(@c10 lt @c12))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(BOOLEAN)" ]; + 4 [ label=<
Predicate Filter
WHERE q2.D EQUALS q42._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(BOOLEAN AS _0)" ]; + 5 [ label=<
Value Computation
EXPLODE arrayDistinct(array(@c10 lt @c12))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(BOOLEAN AS _0)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ label=< q42> label="q42" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -339,18 +335,18 @@ A rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}Ó +}æ B - unnamed-25EXPLAIN select a, e from ta where e in ('bar', 'doe')Œ -«¥¿Ž+¡ ‡½È (C0âû|8v@wISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.E EQUALS _ AS q1 RETURN (q0.A AS A, q0.E AS E) }ôdigraph G { + unnamed-25EXPLAIN select a, e from ta where e in ('bar', 'doe')Ÿ +«ç¼¶7¡ �ËŠ(C0·Ã³8x@zISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.E EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.E AS E) }ƒdigraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.A AS A, q2.E AS E)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, STRING AS E)" ]; 2 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 3 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; - 4 [ label=<
Predicate Filter
WHERE q2.E EQUALS q42
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING)" ]; - 5 [ label=<
Value Computation
EXPLODE arrayDistinct(@c9)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING)" ]; + 4 [ label=<
Predicate Filter
WHERE q2.E EQUALS q42._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS _0)" ]; + 5 [ label=<
Value Computation
EXPLODE arrayDistinct(@c9)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS _0)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ label=< q42> label="q42" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -363,18 +359,18 @@ B rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}Ì +}ß ; - unnamed-2.EXPLAIN select a, e from ta where e in ('foo')Œ -«¥¿Ž+¡ ‡½È (C0âû|8v@wISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.E EQUALS _ AS q1 RETURN (q0.A AS A, q0.E AS E) }ôdigraph G { + unnamed-2.EXPLAIN select a, e from ta where e in ('foo')Ÿ +«ç¼¶7¡ �ËŠ(C0·Ã³8x@zISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.E EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.E AS E) }ƒdigraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.A AS A, q2.E AS E)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, STRING AS E)" ]; 2 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 3 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; - 4 [ label=<
Predicate Filter
WHERE q2.E EQUALS q42
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING)" ]; - 5 [ label=<
Value Computation
EXPLODE arrayDistinct(@c9)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING)" ]; + 4 [ label=<
Predicate Filter
WHERE q2.E EQUALS q42._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS _0)" ]; + 5 [ label=<
Value Computation
EXPLODE arrayDistinct(@c9)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS _0)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ label=< q42> label="q42" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -387,18 +383,18 @@ B rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}— +}© L - unnamed-2?EXPLAIN select a, e from ta where e in ('b' + 'a' + 'r', 'doe')Æ -«‡Ç™'¡ ¬£È (C0ªÓ†8v@“ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(array(@c10 + @c12 + @c14, @c16)) | FILTER q0.E EQUALS _ AS q1 RETURN (q0.A AS A, q0.E AS E) }�digraph G { + unnamed-2?EXPLAIN select a, e from ta where e in ('b' + 'a' + 'r', 'doe')Ø +«»™�0¡ ç­ý (C0“©®8x@–ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(array(@c10 + @c12 + @c14, @c16)) | FILTER q0.E EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.E AS E) }Ÿdigraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.A AS A, q2.E AS E)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, STRING AS E)" ]; 2 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 3 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; - 4 [ label=<
Predicate Filter
WHERE q2.E EQUALS q42
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING)" ]; - 5 [ label=<
Value Computation
EXPLODE arrayDistinct(array(@c10 + @c12 + @c14, @c16))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING)" ]; + 4 [ label=<
Predicate Filter
WHERE q2.E EQUALS q42._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS _0)" ]; + 5 [ label=<
Value Computation
EXPLODE arrayDistinct(array(@c10 + @c12 + @c14, @c16))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS _0)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ label=< q42> label="q42" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -414,7 +410,7 @@ L }é M unnamed-2@EXPLAIN select a, b from ta where (a, b) in ((0L, 9L), (1L, 8L))— -âÿàÎ)¼ ó£Ï (I0¥ÄŒ8�@ƒISCAN(F1 <,>) | FILTER (_.A AS A, _.B AS B) IN array((@c15 AS _0, @c17 AS _1), (@c21 AS _0, @c23 AS _1)) | MAP (_.A AS A, _.B AS B)ðdigraph G { +âó‹ÏA¼ ‚·È(I0—»ß8‘@ƒISCAN(F1 <,>) | FILTER (_.A AS A, _.B AS B) IN array((@c15 AS _0, @c17 AS _1), (@c21 AS _0, @c23 AS _1)) | MAP (_.A AS A, _.B AS B)ðdigraph G { fontname=courier; rankdir=BT; splines=line; @@ -425,16 +421,16 @@ M 3 -> 2 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q39> label="q39" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -}å +}³ K - unnamed-2>EXPLAIN select a, b from ta where f in ((90L, 9L), (81L, 18L))• -ñ¦èš/§ ž®¢ (D0ÆÿŒ8~@ÑEXPLODE arrayDistinct(array((@c11 AS _0, @c13 AS _1), (@c17 AS _0, @c19 AS _1))) | FLATMAP q0 -> { ISCAN(F1 [EQUALS promote(q0._0 AS LONG), EQUALS promote(q0._1 AS LONG)]) AS q1 RETURN (q1.A AS A, q1.B AS B) }¡digraph G { + unnamed-2>EXPLAIN select a, b from ta where f in ((90L, 9L), (81L, 18L))ã +ñÞËå:§ �ÿÚ(D0ïà¶8@µEXPLODE arrayDistinct(array((@c11 AS _0, @c13 AS _1), (@c17 AS _0, @c19 AS _1))) | FLATMAP q0 -> { ISCAN(F1 [EQUALS q0._0._0, EQUALS q0._0._1]) AS q1 RETURN (q1.A AS A, q1.B AS B) }‹digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.A AS A, q2.B AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B)" ]; - 2 [ label=<
Value Computation
EXPLODE arrayDistinct(array((@c11 AS _0, @c13 AS _1), (@c17 AS _0, @c19 AS _1)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, LONG AS _1)" ]; - 3 [ label=<
Index Scan
comparisons: [EQUALS promote(q42._0 AS LONG), EQUALS promote(q42._1 AS LONG)]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; + 2 [ label=<
Value Computation
EXPLODE arrayDistinct(array((@c11 AS _0, @c13 AS _1), (@c17 AS _0, @c19 AS _1)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, LONG AS _1 AS _0)" ]; + 3 [ label=<
Index Scan
comparisons: [EQUALS q42._0._0, EQUALS q42._0._1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 4 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 2 -> 1 [ label=< q42> label="q42" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -447,16 +443,16 @@ K rankDir=LR; 2 -> 3 [ color="red" style="invis" ]; } -}ä +}² b - unnamed-2UEXPLAIN select a, b from ta where f in ((90L, 9L), (81L, 18L), (81L, 18L), (90L, 9L))ý -ñÛ¿û+§ ï™æ (D0†’—8~@…EXPLODE arrayDistinct(array((@c11 AS _0, @c13 AS _1), (@c17 AS _0, @c19 AS _1), (@c17 AS _0, @c19 AS _1), (@c11 AS _0, @c13 AS _1))) | FLATMAP q0 -> { ISCAN(F1 [EQUALS promote(q0._0 AS LONG), EQUALS promote(q0._1 AS LONG)]) AS q1 RETURN (q1.A AS A, q1.B AS B) }Õdigraph G { + unnamed-2UEXPLAIN select a, b from ta where f in ((90L, 9L), (81L, 18L), (81L, 18L), (90L, 9L))Ë +ñ¨—Ê=§ ËçÖ(D0òÅ»8@éEXPLODE arrayDistinct(array((@c11 AS _0, @c13 AS _1), (@c17 AS _0, @c19 AS _1), (@c17 AS _0, @c19 AS _1), (@c11 AS _0, @c13 AS _1))) | FLATMAP q0 -> { ISCAN(F1 [EQUALS q0._0._0, EQUALS q0._0._1]) AS q1 RETURN (q1.A AS A, q1.B AS B) }¿digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.A AS A, q2.B AS B)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B)" ]; - 2 [ label=<
Value Computation
EXPLODE arrayDistinct(array((@c11 AS _0, @c13 AS _1), (@c17 AS _0, @c19 AS _1), (@c17 AS _0, @c19 AS _1), (@c11 AS _0, @c13 AS _1)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, LONG AS _1)" ]; - 3 [ label=<
Index Scan
comparisons: [EQUALS promote(q42._0 AS LONG), EQUALS promote(q42._1 AS LONG)]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; + 2 [ label=<
Value Computation
EXPLODE arrayDistinct(array((@c11 AS _0, @c13 AS _1), (@c17 AS _0, @c19 AS _1), (@c17 AS _0, @c19 AS _1), (@c11 AS _0, @c13 AS _1)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, LONG AS _1 AS _0)" ]; + 3 [ label=<
Index Scan
comparisons: [EQUALS q42._0._0, EQUALS q42._0._1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 4 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 2 -> 1 [ label=< q42> label="q42" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -483,16 +479,16 @@ b 3 -> 2 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q39> label="q39" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -}à +}Ö : - unnamed-2-EXPLAIN select a, e from ta where 1 in (2, 3)„ -­¾“µ „ ÀÏ€ (>0¬Âg8v@vEXPLODE arrayDistinct(@c9) | FILTER @c7 EQUALS _ | FLATMAP q0 -> { ISCAN(F1 <,>) AS q1 RETURN (q1.A AS A, q1.E AS E) }ídigraph G { + unnamed-2-EXPLAIN select a, e from ta where 1 in (2, 3)— +­«Æž1„ § Ì (>0а±8x@yEXPLODE arrayDistinct(@c9) | FILTER @c7 EQUALS _._0 | FLATMAP q0 -> { ISCAN(F1 <,>) AS q1 RETURN (q1.A AS A, q1.E AS E) }üdigraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.A AS A, q2.E AS E)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, STRING AS E)" ]; - 2 [ label=<
Predicate Filter
WHERE @c7 EQUALS q46
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT)" ]; - 3 [ label=<
Value Computation
EXPLODE arrayDistinct(@c9)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT)" ]; + 2 [ label=<
Predicate Filter
WHERE @c7 EQUALS q46._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _0)" ]; + 3 [ label=<
Value Computation
EXPLODE arrayDistinct(@c9)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _0)" ]; 4 [ label=<
Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 5 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 3 -> 2 [ label=< q46> label="q46" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -507,17 +503,17 @@ b rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}‚ +}Ž : - unnamed-2-EXPLAIN select a from ta where 1 in (1, 2, 3)à -áÀ€‹$‰ ÉЭ(A0ȤŽ8€@ ¦EXPLODE arrayDistinct(@c7) | FLATMAP q0 -> { COVERING(F1 <,> -> [A: KEY:[3], F: [SA: KEY:[0], SB: KEY:[1]]]) | FILTER @c5 EQUALS q0 | MAP (_.A AS A) AS q1 RETURN q1 }ùdigraph G { + unnamed-2-EXPLAIN select a from ta where 1 in (1, 2, 3)Ï +á¾¾÷!‰ ™½ì(A0ñ¿Š8‚@ ©EXPLODE arrayDistinct(@c7) | FLATMAP q0 -> { COVERING(F1 <,> -> [A: KEY:[3], F: [SA: KEY:[0], SB: KEY:[1]]]) | FILTER @c5 EQUALS q0._0 | MAP (_.A AS A) AS q1 RETURN q1 }‚digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP q62
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A)" ]; - 2 [ label=<
Value Computation
EXPLODE arrayDistinct(@c7)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT)" ]; + 2 [ label=<
Value Computation
EXPLODE arrayDistinct(@c7)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _0)" ]; 3 [ label=<
Value Computation
MAP (q74.A AS A)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A)" ]; - 4 [ label=<
Predicate Filter
WHERE @c5 EQUALS q47
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; + 4 [ label=<
Predicate Filter
WHERE @c5 EQUALS q47._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 5 [ label=<
Covering Index Scan
range: <-∞, ∞>
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 6 [ label=<
Index
F1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS A, LONG AS B, DOUBLE AS C, BOOLEAN AS D, STRING AS E, LONG AS SA, LONG AS SB AS F)" ]; 2 -> 1 [ label=< q47> label="q47" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -533,23 +529,23 @@ b rankDir=LR; 2 -> 3 [ color="red" style="invis" ]; } -}› +}Á s - unnamed-2fEXPLAIN select id from array_table where exists (select 1 from array_table.fruits f where f = 'apple')£ -É»—Š ˆ º›Ä("0ƒ‚8,@BCOVERING(FRUITS [EQUALS @c17] -> [ID: KEY:[2]]) | MAP (_.ID AS ID)À digraph G { + unnamed-2fEXPLAIN select id from array_table where exists (select 1 from array_table.fruits f where f = 'apple')É +×Ï„±� ¨è©($0­ƒ$80@UCOVERING(FRUITS [EQUALS promote(@c17 AS STRING)] -> [ID: KEY:[2]]) | MAP (_.ID AS ID)Ó digraph G { fontname=courier; rankdir=BT; splines=line; - 1 [ label=<
Value Computation
MAP (q62.ID AS ID)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID)" ]; - 2 [ label=<
Covering Index Scan
comparisons: [EQUALS @c17]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS)" ]; + 1 [ label=<
Value Computation
MAP (q63.ID AS ID)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID)" ]; + 2 [ label=<
Covering Index Scan
comparisons: [EQUALS promote(@c17 AS STRING)]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS)" ]; 3 [ label=<
Index
FRUITS
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 2 -> 1 [ label=< q62> label="q62" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -}® + 2 -> 1 [ label=< q63> label="q63" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +}± G - unnamed-2:EXPLAIN select id from array_table where 'apple' in fruitsâ + unnamed-2:EXPLAIN select id from array_table where 'apple' in fruitså Õ -r ªÁ‡(0µ„'8 @|SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.FRUITS) | FILTER @c5 EQUALS _ AS q1 RETURN (q0.ID AS ID) }Ædigraph G { +r ªÁ‡(0µ„'8 @SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.FRUITS) | FILTER @c5 EQUALS _._0 AS q1 RETURN (q0.ID AS ID) }Ædigraph G { fontname=courier; rankdir=BT; splines=line; @@ -573,11 +569,11 @@ G rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}¯ +}² H - unnamed-2;EXPLAIN select id from array_table where 'banana' in fruitsâ + unnamed-2;EXPLAIN select id from array_table where 'banana' in fruitså Õ -r ªÁ‡(0µ„'8 @|SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.FRUITS) | FILTER @c5 EQUALS _ AS q1 RETURN (q0.ID AS ID) }Ædigraph G { +r ªÁ‡(0µ„'8 @SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.FRUITS) | FILTER @c5 EQUALS _._0 AS q1 RETURN (q0.ID AS ID) }Ædigraph G { fontname=courier; rankdir=BT; splines=line; @@ -601,11 +597,11 @@ H rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}² +}µ K - unnamed-2>EXPLAIN select id from array_table where 'pineapple' in fruitsâ + unnamed-2>EXPLAIN select id from array_table where 'pineapple' in fruitså Õ -r ªÁ‡(0µ„'8 @|SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.FRUITS) | FILTER @c5 EQUALS _ AS q1 RETURN (q0.ID AS ID) }Ædigraph G { +r ªÁ‡(0µ„'8 @SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.FRUITS) | FILTER @c5 EQUALS _._0 AS q1 RETURN (q0.ID AS ID) }Ædigraph G { fontname=courier; rankdir=BT; splines=line; @@ -629,10 +625,10 @@ K rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}è" +}ë" o - unnamed-2bEXPLAIN select id from array_table where exists (select 1 from array_table.numbers n where n = 10)ô! -àÙÒ–f ÷”¬(0Ó—8 @µSCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE q0.NUMBERS | FILTER _ EQUALS promote(@c17 AS LONG) | MAP (@c8 AS _0) | DEFAULT NULL | FILTER _ NOT_NULL AS q1 RETURN (q0.ID AS ID) }ž digraph G { + unnamed-2bEXPLAIN select id from array_table where exists (select 1 from array_table.numbers n where n = 10)÷! +àÙÒ–f ÷”¬(0Ó—8 @¸SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE q0.NUMBERS | FILTER _._0 EQUALS promote(@c17 AS LONG) | MAP (@c8 AS _0) | DEFAULT NULL | FILTER _ NOT_NULL AS q1 RETURN (q0.ID AS ID) }ž digraph G { fontname=courier; rankdir=BT; splines=line; @@ -662,10 +658,10 @@ o rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}Ë +}Î C - unnamed-26EXPLAIN select id from array_table where 10 in numbersƒ -Õ— ¬ r ’ƒË(0þ¼8 @ŽSCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.NUMBERS) | FILTER promote(@c5 AS LONG) EQUALS _ AS q1 RETURN (q0.ID AS ID) }Ôdigraph G { + unnamed-26EXPLAIN select id from array_table where 10 in numbers† +Õ— ¬ r ’ƒË(0þ¼8 @‘SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.NUMBERS) | FILTER promote(@c5 AS LONG) EQUALS _._0 AS q1 RETURN (q0.ID AS ID) }Ôdigraph G { fontname=courier; rankdir=BT; splines=line; @@ -689,10 +685,10 @@ C rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}Ë +}Î C - unnamed-26EXPLAIN select id from array_table where 15 in numbersƒ -Õ— ¬ r ’ƒË(0þ¼8 @ŽSCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.NUMBERS) | FILTER promote(@c5 AS LONG) EQUALS _ AS q1 RETURN (q0.ID AS ID) }Ôdigraph G { + unnamed-26EXPLAIN select id from array_table where 15 in numbers† +Õ— ¬ r ’ƒË(0þ¼8 @‘SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.NUMBERS) | FILTER promote(@c5 AS LONG) EQUALS _._0 AS q1 RETURN (q0.ID AS ID) }Ôdigraph G { fontname=courier; rankdir=BT; splines=line; @@ -804,20 +800,19 @@ K 3 -> 2 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q32> label="q32" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -}‡5 +}“5 ô - unnamed-2æEXPLAIN SELECT t_child.id AS child_id, t_child.num AS num, t_parent.id AS parent_id FROM t_parent, t_child WHERE get_key(t_child.t_link) = t_parent.id AND 'tag_a' IN t_parent.lst AND t_parent.id = 'p1' AND t_child.num IN (1, 2, 3)�3 -ŽI¬îñÔƒ ò’Žv(‚0” ÒO8ò -@ŸôSCAN([IS T_PARENT, EQUALS promote(@c44 AS STRING)]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.LST) | FLATMAP q1 -> { [IN arrayDistinct(promote(@c50 AS ARRAY(LONG)))] | INJOIN q2 -> { SCAN([IS T_CHILD]) | FILTER _.T_LINK.NAME EQUALS q0.ID AND _.NUM EQUALS q2 } | FILTER @c34 EQUALS q1 AS q3 RETURN q3 } AS q4 RETURN (q4.ID AS CHILD_ID, q4.NUM AS NUM, q0.ID AS PARENT_ID) }ò/digraph G { + unnamed-2æEXPLAIN SELECT t_child.id AS child_id, t_child.num AS num, t_parent.id AS parent_id FROM t_parent, t_child WHERE get_key(t_child.t_link) = t_parent.id AND 'tag_a' IN t_parent.lst AND t_parent.id = 'p1' AND t_child.num IN (1, 2, 3)™3 +ŽI韟ýƒ 戴x(‚0ÿª¼Y8’ @Ÿ÷SCAN([IS T_PARENT, EQUALS promote(@c44 AS STRING)]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.LST) | FLATMAP q1 -> { [IN arrayDistinct(promote(@c50 AS ARRAY(LONG)))] | INJOIN q2 -> { SCAN([IS T_CHILD]) | FILTER _.T_LINK.NAME EQUALS q0.ID AND _.NUM EQUALS q2 } | FILTER @c34 EQUALS q1._0 AS q3 RETURN q3 } AS q4 RETURN (q4.ID AS CHILD_ID, q4.NUM AS NUM, q0.ID AS PARENT_ID) }û/digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q6.ID AS CHILD_ID, q6.NUM AS NUM, q2.ID AS PARENT_ID)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS CHILD_ID, LONG AS NUM, STRING AS PARENT_ID)" ]; 2 [ label=<
Scan
comparisons: [IS T_PARENT, EQUALS promote(@c44 AS STRING)]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS ID, ARRAY(STRING) AS LST)" ]; 3 [ label=<
Primary Storage
record types: [T_CHILD, ARRAY_TABLE, T_PARENT, TA]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS ID, ARRAY(STRING) AS LST)" ]; - 4 [ label=<
Nested Loop Join
FLATMAP q399
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS ID, STRING AS NAME, STRING AS COLOR AS T_LINK, LONG AS NUM)" ]; - 5 [ label=<
Predicate Filter
WHERE @c34 EQUALS q166
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS ID, STRING AS NAME, STRING AS COLOR AS T_LINK, LONG AS NUM)" ]; - 6 [ label=<
Value Computation
EXPLODE arrayDistinct(q2.LST)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING)" ]; + 4 [ label=<
Nested Loop Join
FLATMAP q401
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS ID, STRING AS NAME, STRING AS COLOR AS T_LINK, LONG AS NUM)" ]; + 5 [ label=<
Value Computation
EXPLODE arrayDistinct(q2.LST)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS _0)" ]; + 6 [ label=<
Predicate Filter
WHERE @c34 EQUALS q166._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS ID, STRING AS NAME, STRING AS COLOR AS T_LINK, LONG AS NUM)" ]; 7 [ label=<
Nested Loop Join
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(STRING AS ID, STRING AS NAME, STRING AS COLOR AS T_LINK, LONG AS NUM)" ]; 8 [ label=<
Predicate Filter
WHERE q6.T_LINK.NAME EQUALS q2.ID AND q6.NUM EQUALS q108
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS ID, STRING AS NAME, STRING AS COLOR AS T_LINK, LONG AS NUM)" ]; 9 [ label=<
Table Function
EXPLODE(arrayDistinct(promote(@c50 AS ARRAY(LONG))))
> color="black" shape="plain" style="filled" fillcolor="darkseagreen2" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS ID, STRING AS NAME, STRING AS COLOR AS T_LINK, LONG AS NUM)" ]; @@ -825,27 +820,27 @@ K 11 [ label=<
Primary Storage
record types: [T_CHILD, ARRAY_TABLE, T_PARENT, TA]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS ID, STRING AS NAME, STRING AS COLOR AS T_LINK, LONG AS NUM)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 5 -> 4 [ label=< q399> label="q399" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 6 -> 4 [ label=< q166> label="q166" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 7 -> 5 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q166> label="q166" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 4 [ label=< q401> label="q401" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 8 -> 7 [ color="black" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 9 -> 7 [ color="black" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 10 -> 8 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 11 -> 10 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 4 -> 1 [ label=< q6> label="q6" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; { - 5 -> 4 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 6 -> 4 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { rank=same; rankDir=LR; - 6 -> 5 [ color="red" style="invis" ]; + 5 -> 6 [ color="red" style="invis" ]; } { - 8 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 5 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { - 6 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 8 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { rank=same; @@ -857,44 +852,47 @@ K rankDir=LR; 9 -> 8 [ color="red" style="invis" ]; } -}–! +}Ÿ" ] - unnamed-2PEXPLAIN SELECT t.id, n FROM array_table AS t, t.numbers AS n WHERE n IN (10, 20)´ -¤‚ã’"¨ Ž�Î(60ä­¿8s@ÎEXPLODE arrayDistinct(promote(@c19 AS ARRAY(LONG))) | FLATMAP q0 -> { SCAN([IS ARRAY_TABLE]) | FLATMAP q1 -> { EXPLODE q1.NUMBERS | FILTER _ EQUALS q0 AS q2 RETURN (q1.ID AS ID, q2 AS N) } AS q3 RETURN q3 }Ãdigraph G { + unnamed-2PEXPLAIN SELECT t.id, n FROM array_table AS t, t.numbers AS n WHERE n IN (10, 20)½! +¤Šèû*§ ¸ÓØ (60êÔ¶8u@×SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c19 AS ARRAY(LONG))) | FLATMAP q1 -> { EXPLODE q0.NUMBERS | FILTER _._0 EQUALS q1._0 AS q2 RETURN q2 } AS q2 RETURN (q0.ID AS ID, q2._0 AS N) }Ãdigraph G { fontname=courier; rankdir=BT; splines=line; - 1 [ label=<
Nested Loop Join
FLATMAP q92
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, LONG AS N)" ]; - 2 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(@c19 AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; - 3 [ label=<
Nested Loop Join
FLATMAP (q2.ID AS ID, q4 AS N)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, LONG AS N)" ]; - 4 [ label=<
Scan
comparisons: [IS ARRAY_TABLE]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS)" ]; - 5 [ label=<
Predicate Filter
WHERE q4 EQUALS q62
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; - 6 [ label=<
Primary Storage
record types: [T_CHILD, ARRAY_TABLE, T_PARENT, TA]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS)" ]; - 7 [ label=<
Value Computation
EXPLODE q2.NUMBERS
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; - 2 -> 1 [ label=< q62> label="q62" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 4 -> 3 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 5 -> 3 [ label=< q4> label="q4" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 6 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 7 -> 5 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 3 -> 1 [ label=< q92> label="q92" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - { - 7 -> 3 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; - } + 1 [ label=<
Nested Loop Join
FLATMAP (q2.ID AS ID, q4._0 AS N)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, LONG AS N)" ]; + 2 [ label=<
Scan
comparisons: [IS ARRAY_TABLE]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS)" ]; + 3 [ label=<
Primary Storage
record types: [T_CHILD, ARRAY_TABLE, T_PARENT, TA]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS)" ]; + 4 [ label=<
Nested Loop Join
FLATMAP q4
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 5 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(@c19 AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 6 [ label=<
Predicate Filter
WHERE q4._0 EQUALS q37._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 7 [ label=<
Value Computation
EXPLODE q2.NUMBERS
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q37> label="q37" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 4 [ label=< q4> label="q4" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 1 [ label=< q4> label="q4" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; { - 5 -> 3 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 6 -> 4 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { rank=same; rankDir=LR; - 4 -> 5 [ color="red" style="invis" ]; + 5 -> 6 [ color="red" style="invis" ]; } { - 5 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 7 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + } + { + 6 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + } + { + 4 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { rank=same; rankDir=LR; - 2 -> 3 [ color="red" style="invis" ]; + 2 -> 4 [ color="red" style="invis" ]; } }É U @@ -918,93 +916,93 @@ U rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}¨" +}¸" i - unnamed-2\EXPLAIN SELECT t.id, n, idx FROM array_table AS t, t.numbers AS n AT idx WHERE n IN (10, 20)º! -¤”·™'§ ‡Óé(60¼Ò¸8s@öEXPLODE arrayDistinct(promote(@c23 AS ARRAY(LONG))) | FLATMAP q0 -> { SCAN([IS ARRAY_TABLE]) | FLATMAP q1 -> { EXPLODE q1.NUMBERS WITH ORDINALITY | FILTER _._0 EQUALS q0 AS q2 RETURN (q1.ID AS ID, q2._0 AS N, q2._1 + 1 AS IDX) } AS q3 RETURN q3 }¡digraph G { + unnamed-2\EXPLAIN SELECT t.id, n, idx FROM array_table AS t, t.numbers AS n AT idx WHERE n IN (10, 20)Ê! +™íøÖ.¦ Þó´ +(50Ýø«8t@ùEXPLODE arrayDistinct(promote(@c23 AS ARRAY(LONG))) | FLATMAP q0 -> { SCAN([IS ARRAY_TABLE]) | FLATMAP q1 -> { EXPLODE q1.NUMBERS WITH ORDINALITY | FILTER _._0 EQUALS q0._0 AS q2 RETURN (q1.ID AS ID, q2._0 AS N, q2._1 + 1 AS IDX) } AS q3 RETURN q3 }®digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP q92
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, LONG AS N, INT AS IDX)" ]; - 2 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(@c23 AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; - 3 [ label=<
Nested Loop Join
FLATMAP (q2.ID AS ID, q4._0 AS N, q4._1 AS IDX)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, LONG AS N, INT AS IDX)" ]; - 4 [ label=<
Scan
comparisons: [IS ARRAY_TABLE]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS)" ]; - 5 [ label=<
Predicate Filter
WHERE q4._0 EQUALS q62
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, INT AS _1)" ]; - 6 [ label=<
Primary Storage
record types: [T_CHILD, ARRAY_TABLE, T_PARENT, TA]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS)" ]; - 7 [ label=<
Value Computation
EXPLODE q2.NUMBERS WITH ORDINALITY
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, INT AS _1)" ]; + 2 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(@c23 AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 3 [ label=<
Nested Loop Join
FLATMAP (q2.ID AS ID, q4._0 AS N, q4._1 + 1 AS IDX)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, LONG AS N, INT AS IDX)" ]; + 4 [ label=<
Predicate Filter
WHERE q4._0 EQUALS q62._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, INT AS _1)" ]; + 5 [ label=<
Scan
comparisons: [IS ARRAY_TABLE]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS)" ]; + 6 [ label=<
Value Computation
EXPLODE q2.NUMBERS WITH ORDINALITY
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, INT AS _1)" ]; + 7 [ label=<
Primary Storage
record types: [T_CHILD, ARRAY_TABLE, T_PARENT, TA]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS)" ]; 2 -> 1 [ label=< q62> label="q62" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 4 -> 3 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 5 -> 3 [ label=< q4> label="q4" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 6 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 7 -> 5 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 3 [ label=< q4> label="q4" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 3 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 4 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 3 -> 1 [ label=< q92> label="q92" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; { - 5 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 6 -> 3 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { - rank=same; - rankDir=LR; - 2 -> 3 [ color="red" style="invis" ]; + 4 -> 3 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { - 7 -> 3 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + rank=same; + rankDir=LR; + 5 -> 4 [ color="red" style="invis" ]; } { - 5 -> 3 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 4 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { rank=same; rankDir=LR; - 4 -> 5 [ color="red" style="invis" ]; + 2 -> 3 [ color="red" style="invis" ]; } -}ƒ" +}½# i - unnamed-2\EXPLAIN SELECT t.id, n, idx FROM array_table AS t, t.numbers AS n AT idx WHERE idx IN (1, 3)•! -™è’–"¦ €ÁÈ -(50„ñð8r@âEXPLODE arrayDistinct(@c23) | FLATMAP q0 -> { SCAN([IS ARRAY_TABLE]) | FLATMAP q1 -> { EXPLODE q1.NUMBERS WITH ORDINALITY | FILTER _._1 + 1 EQUALS q0 AS q2 RETURN (q1.ID AS ID, q2._0 AS N, q2._1 + 1 AS IDX) } AS q3 RETURN q3 }�digraph G { + unnamed-2\EXPLAIN SELECT t.id, n, idx FROM array_table AS t, t.numbers AS n AT idx WHERE idx IN (1, 3)Ï" +™­š£%¦ éØ˜(50Ìäé8t@€EXPLODE arrayDistinct(@c23) | FLATMAP q0 -> { SCAN([IS ARRAY_TABLE]) | FLATMAP q1 -> { EXPLODE q1.NUMBERS WITH ORDINALITY | FILTER _._1 + 1 EQUALS q0._0 AS q2 RETURN (q1 AS _0, q2 AS _1) } AS q3 RETURN (q3._0.ID AS ID, q3._1._0 AS N, q3._1._1 + 1 AS IDX) }¬ digraph G { fontname=courier; rankdir=BT; splines=line; - 1 [ label=<
Nested Loop Join
FLATMAP q92
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, LONG AS N, INT AS IDX)" ]; - 2 [ label=<
Value Computation
EXPLODE arrayDistinct(@c23)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT)" ]; - 3 [ label=<
Nested Loop Join
FLATMAP (q2.ID AS ID, q4._0 AS N, q4._1 + 1 AS IDX)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, LONG AS N, INT AS IDX)" ]; - 4 [ label=<
Predicate Filter
WHERE q4._1 + 1 EQUALS q62
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, INT AS _1)" ]; - 5 [ label=<
Scan
comparisons: [IS ARRAY_TABLE]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS)" ]; - 6 [ label=<
Value Computation
EXPLODE q2.NUMBERS WITH ORDINALITY
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, INT AS _1)" ]; - 7 [ label=<
Primary Storage
record types: [T_CHILD, ARRAY_TABLE, T_PARENT, TA]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS)" ]; + 1 [ label=<
Nested Loop Join
FLATMAP (q66._0.ID AS ID, q66._1._0 AS N, q66._1._1 + 1 AS IDX)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, LONG AS N, INT AS IDX)" ]; + 2 [ label=<
Value Computation
EXPLODE arrayDistinct(@c23)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _0)" ]; + 3 [ label=<
Nested Loop Join
FLATMAP (q2 AS _0, q4 AS _1)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS AS _0, LONG AS _0, INT AS _1 AS _1)" ]; + 4 [ label=<
Scan
comparisons: [IS ARRAY_TABLE]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS)" ]; + 5 [ label=<
Predicate Filter
WHERE q4._1 + 1 EQUALS q62._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, INT AS _1)" ]; + 6 [ label=<
Primary Storage
record types: [T_CHILD, ARRAY_TABLE, T_PARENT, TA]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS)" ]; + 7 [ label=<
Value Computation
EXPLODE q2.NUMBERS WITH ORDINALITY
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0, INT AS _1)" ]; 2 -> 1 [ label=< q62> label="q62" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 4 -> 3 [ label=< q4> label="q4" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 5 -> 3 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 6 -> 4 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 7 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 3 -> 1 [ label=< q92> label="q92" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - { - 6 -> 3 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; - } + 4 -> 3 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 3 [ label=< q4> label="q4" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 5 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 3 -> 1 [ label=< q66> label="q66" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; { - 4 -> 3 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 5 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { rank=same; rankDir=LR; - 5 -> 4 [ color="red" style="invis" ]; + 2 -> 3 [ color="red" style="invis" ]; } { - 4 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 7 -> 3 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + } + { + 5 -> 3 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { rank=same; rankDir=LR; - 2 -> 3 [ color="red" style="invis" ]; + 4 -> 5 [ color="red" style="invis" ]; } -}¸ +}¼ j - unnamed-2]EXPLAIN SELECT t.id, n, idx FROM array_table AS t, t.numbers AS n AT idx WHERE t.id IN (2, 4)É -Ž ©òü1Æ ¨·—(F0ÞÁ¿8Œ@ Õ[IN arrayDistinct(promote(@c25 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS ARRAY_TABLE, EQUALS q0]) } | FLATMAP q1 -> { EXPLODE q1.NUMBERS WITH ORDINALITY AS q2 RETURN (q1.ID AS ID, q2._0 AS N, q2._1 + 1 AS IDX) }Ðdigraph G { + unnamed-2]EXPLAIN SELECT t.id, n, idx FROM array_table AS t, t.numbers AS n AT idx WHERE t.id IN (2, 4)Í +Ž Ûª†,Æ Ú¿€ (F0÷î±8�@ Õ[IN arrayDistinct(promote(@c25 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS ARRAY_TABLE, EQUALS q0]) } | FLATMAP q1 -> { EXPLODE q1.NUMBERS WITH ORDINALITY AS q2 RETURN (q1.ID AS ID, q2._0 AS N, q2._1 + 1 AS IDX) }Ôdigraph G { fontname=courier; rankdir=BT; splines=line; - 1 [ label=<
Nested Loop Join
FLATMAP (q2.ID AS ID, q4._0 AS N, q4._1 AS IDX)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, LONG AS N, INT AS IDX)" ]; + 1 [ label=<
Nested Loop Join
FLATMAP (q2.ID AS ID, q4._0 AS N, q4._1 + 1 AS IDX)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, LONG AS N, INT AS IDX)" ]; 2 [ label=<
Nested Loop Join
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS)" ]; 3 [ label=<
Table Function
EXPLODE(arrayDistinct(promote(@c25 AS ARRAY(LONG))))
> color="black" shape="plain" style="filled" fillcolor="darkseagreen2" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS)" ]; 4 [ label=<
Scan
comparisons: [IS ARRAY_TABLE, EQUALS q39]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS)" ]; @@ -1028,18 +1026,18 @@ j rankDir=LR; 2 -> 6 [ color="red" style="invis" ]; } -}‰" +}™" r - unnamed-2eEXPLAIN SELECT t.id, f, idx FROM array_table AS t, t.fruits AS f AT idx WHERE f IN ('apple', 'mango')’! -¤Äó›%§ Ô¾Õ(60Æýš8s@ÝEXPLODE arrayDistinct(@c23) | FLATMAP q0 -> { SCAN([IS ARRAY_TABLE]) | FLATMAP q1 -> { EXPLODE q1.FRUITS WITH ORDINALITY | FILTER _._0 EQUALS q0 AS q2 RETURN (q1.ID AS ID, q2._0 AS F, q2._1 + 1 AS IDX) } AS q3 RETURN q3 }’digraph G { + unnamed-2eEXPLAIN SELECT t.id, f, idx FROM array_table AS t, t.fruits AS f AT idx WHERE f IN ('apple', 'mango')¢! +™ÊÀô4¦ È÷ò (50õúä8t@àEXPLODE arrayDistinct(@c23) | FLATMAP q0 -> { SCAN([IS ARRAY_TABLE]) | FLATMAP q1 -> { EXPLODE q1.FRUITS WITH ORDINALITY | FILTER _._0 EQUALS q0._0 AS q2 RETURN (q1.ID AS ID, q2._0 AS F, q2._1 + 1 AS IDX) } AS q3 RETURN q3 }Ÿdigraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP q92
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS F, INT AS IDX)" ]; - 2 [ label=<
Value Computation
EXPLODE arrayDistinct(@c23)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING)" ]; - 3 [ label=<
Nested Loop Join
FLATMAP (q2.ID AS ID, q4._0 AS F, q4._1 AS IDX)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS F, INT AS IDX)" ]; + 2 [ label=<
Value Computation
EXPLODE arrayDistinct(@c23)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS _0)" ]; + 3 [ label=<
Nested Loop Join
FLATMAP (q2.ID AS ID, q4._0 AS F, q4._1 + 1 AS IDX)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS F, INT AS IDX)" ]; 4 [ label=<
Scan
comparisons: [IS ARRAY_TABLE]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS)" ]; - 5 [ label=<
Predicate Filter
WHERE q4._0 EQUALS q62
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS _0, INT AS _1)" ]; + 5 [ label=<
Predicate Filter
WHERE q4._0 EQUALS q62._0
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS _0, INT AS _1)" ]; 6 [ label=<
Primary Storage
record types: [T_CHILD, ARRAY_TABLE, T_PARENT, TA]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(STRING) AS FRUITS, ARRAY(LONG) AS NUMBERS, ARRAY(STRING AS NAME, STRING AS COLOR) AS FRUIT_RECORDS)" ]; 7 [ label=<
Value Computation
EXPLODE q2.FRUITS WITH ORDINALITY
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS _0, INT AS _1)" ]; 2 -> 1 [ label=< q62> label="q62" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; diff --git a/yaml-tests/src/test/resources/in-predicate.metrics.yaml b/yaml-tests/src/test/resources/in-predicate.metrics.yaml index 26901c1ac31..d185a335afa 100644 --- a/yaml-tests/src/test/resources/in-predicate.metrics.yaml +++ b/yaml-tests/src/test/resources/in-predicate.metrics.yaml @@ -2,250 +2,255 @@ unnamed-2: - query: EXPLAIN select a, b from ta where b in (1, 3, 5, 7) ref: in-predicate.yamsql:72 explain: ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS - ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) } + ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) + } task_count: 939 - task_total_time_ms: 91 + task_total_time_ms: 105 transform_count: 289 - transform_time_ms: 20 + transform_time_ms: 24 transform_yield_count: 67 insert_time_ms: 2 - insert_new_count: 118 + insert_new_count: 120 insert_reused_count: 7 - query: EXPLAIN select a, b from ta where b in (6) ref: in-predicate.yamsql:77 explain: ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS - ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) } + ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) + } task_count: 939 - task_total_time_ms: 91 + task_total_time_ms: 105 transform_count: 289 - transform_time_ms: 20 + transform_time_ms: 24 transform_yield_count: 67 insert_time_ms: 2 - insert_new_count: 118 + insert_new_count: 120 insert_reused_count: 7 - query: EXPLAIN select a, b from ta where b in (10, 33, 66) ref: in-predicate.yamsql:86 explain: ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS - ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) } + ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) + } task_count: 939 - task_total_time_ms: 91 + task_total_time_ms: 105 transform_count: 289 - transform_time_ms: 20 + transform_time_ms: 24 transform_yield_count: 67 insert_time_ms: 2 - insert_new_count: 118 + insert_new_count: 120 insert_reused_count: 7 - query: EXPLAIN select a, b from ta where b in (1 + 0, 3 + 0, 5, 7) ref: in-predicate.yamsql:91 explain: ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(array(@c10 - + @c12, @c14 + @c12, @c18, @c20) AS ARRAY(LONG))) | FILTER q0.B EQUALS _ AS - q1 RETURN (q0.A AS A, q0.B AS B) } + + @c12, @c14 + @c12, @c18, @c20) AS ARRAY(LONG))) | FILTER q0.B EQUALS _._0 + AS q1 RETURN (q0.A AS A, q0.B AS B) } task_count: 939 - task_total_time_ms: 86 + task_total_time_ms: 72 transform_count: 289 - transform_time_ms: 24 + transform_time_ms: 22 transform_yield_count: 67 insert_time_ms: 2 - insert_new_count: 118 + insert_new_count: 120 insert_reused_count: 7 - query: EXPLAIN select a, b from ta where b in (1, 1, 1, 1) ref: in-predicate.yamsql:96 explain: ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS - ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) } + ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) + } task_count: 939 - task_total_time_ms: 91 + task_total_time_ms: 105 transform_count: 289 - transform_time_ms: 20 + transform_time_ms: 24 transform_yield_count: 67 insert_time_ms: 2 - insert_new_count: 118 + insert_new_count: 120 insert_reused_count: 7 - query: EXPLAIN select a, b from ta where b in (1, 2, 1, 3) ref: in-predicate.yamsql:105 explain: ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS - ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) } + ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) + } task_count: 939 - task_total_time_ms: 91 + task_total_time_ms: 105 transform_count: 289 - transform_time_ms: 20 + transform_time_ms: 24 transform_yield_count: 67 insert_time_ms: 2 - insert_new_count: 118 + insert_new_count: 120 insert_reused_count: 7 - query: EXPLAIN select a, b from ta where b in (1 + 0, 1 + 0, 1 + 0, 1 + 0) ref: in-predicate.yamsql:114 explain: ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(array(@c10 + @c12, @c10 + @c12, @c10 + @c12, @c10 + @c12) AS ARRAY(LONG))) | FILTER q0.B - EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) } + EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) } task_count: 939 - task_total_time_ms: 74 + task_total_time_ms: 115 transform_count: 289 - transform_time_ms: 19 + transform_time_ms: 33 transform_yield_count: 67 - insert_time_ms: 1 - insert_new_count: 118 + insert_time_ms: 2 + insert_new_count: 120 insert_reused_count: 7 - query: EXPLAIN select a, b from ta where b in (1 + 0, 0 + 1) ref: in-predicate.yamsql:123 explain: ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(array(@c10 - + @c12, @c12 + @c10) AS ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN + + @c12, @c12 + @c10) AS ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) } task_count: 939 - task_total_time_ms: 80 + task_total_time_ms: 109 transform_count: 289 - transform_time_ms: 18 + transform_time_ms: 30 transform_yield_count: 67 - insert_time_ms: 1 - insert_new_count: 118 + insert_time_ms: 2 + insert_new_count: 120 insert_reused_count: 7 - query: EXPLAIN select a, c from ta where c in (4.56, 3.45, 2.34) ref: in-predicate.yamsql:168 explain: ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.C - EQUALS _ AS q1 RETURN (q0.A AS A, q0.C AS C) } + EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.C AS C) } task_count: 939 - task_total_time_ms: 88 + task_total_time_ms: 106 transform_count: 289 - transform_time_ms: 21 + transform_time_ms: 30 transform_yield_count: 67 - insert_time_ms: 2 - insert_new_count: 118 + insert_time_ms: 3 + insert_new_count: 120 insert_reused_count: 7 - query: EXPLAIN select a, c from ta where c in (9.01) ref: in-predicate.yamsql:173 explain: ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.C - EQUALS _ AS q1 RETURN (q0.A AS A, q0.C AS C) } + EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.C AS C) } task_count: 939 - task_total_time_ms: 88 + task_total_time_ms: 106 transform_count: 289 - transform_time_ms: 21 + transform_time_ms: 30 transform_yield_count: 67 - insert_time_ms: 2 - insert_new_count: 118 + insert_time_ms: 3 + insert_new_count: 120 insert_reused_count: 7 - query: EXPLAIN select a, c from ta where c in (3.01 + 6) ref: in-predicate.yamsql:178 explain: ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(array(@c10 + @c12)) - | FILTER q0.C EQUALS _ AS q1 RETURN (q0.A AS A, q0.C AS C) } + | FILTER q0.C EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.C AS C) } task_count: 939 - task_total_time_ms: 95 + task_total_time_ms: 101 transform_count: 289 - transform_time_ms: 21 + transform_time_ms: 26 transform_yield_count: 67 insert_time_ms: 2 - insert_new_count: 118 + insert_new_count: 120 insert_reused_count: 7 - query: EXPLAIN select a, d from ta where d in (true, false) ref: in-predicate.yamsql:183 explain: ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.D - EQUALS _ AS q1 RETURN (q0.A AS A, q0.D AS D) } + EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.D AS D) } task_count: 939 - task_total_time_ms: 93 + task_total_time_ms: 106 transform_count: 289 - transform_time_ms: 21 + transform_time_ms: 24 transform_yield_count: 67 insert_time_ms: 2 - insert_new_count: 118 + insert_new_count: 120 insert_reused_count: 7 - query: EXPLAIN select a, d from ta where d in (true) ref: in-predicate.yamsql:189 explain: ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.D - EQUALS _ AS q1 RETURN (q0.A AS A, q0.D AS D) } + EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.D AS D) } task_count: 939 - task_total_time_ms: 93 + task_total_time_ms: 106 transform_count: 289 - transform_time_ms: 21 + transform_time_ms: 24 transform_yield_count: 67 insert_time_ms: 2 - insert_new_count: 118 + insert_new_count: 120 insert_reused_count: 7 - query: EXPLAIN select a, d from ta where d in (3 < 4) ref: in-predicate.yamsql:194 explain: ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(array(@c10 lt @c12)) - | FILTER q0.D EQUALS _ AS q1 RETURN (q0.A AS A, q0.D AS D) } + | FILTER q0.D EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.D AS D) } task_count: 939 - task_total_time_ms: 76 + task_total_time_ms: 118 transform_count: 289 - transform_time_ms: 17 + transform_time_ms: 29 transform_yield_count: 67 - insert_time_ms: 1 - insert_new_count: 118 + insert_time_ms: 3 + insert_new_count: 120 insert_reused_count: 7 - query: EXPLAIN select a, e from ta where e in ('bar', 'doe') ref: in-predicate.yamsql:199 explain: ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.E - EQUALS _ AS q1 RETURN (q0.A AS A, q0.E AS E) } + EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.E AS E) } task_count: 939 - task_total_time_ms: 90 + task_total_time_ms: 116 transform_count: 289 - transform_time_ms: 20 + transform_time_ms: 29 transform_yield_count: 67 insert_time_ms: 2 - insert_new_count: 118 + insert_new_count: 120 insert_reused_count: 7 - query: EXPLAIN select a, e from ta where e in ('foo') ref: in-predicate.yamsql:204 explain: ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.E - EQUALS _ AS q1 RETURN (q0.A AS A, q0.E AS E) } + EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.E AS E) } task_count: 939 - task_total_time_ms: 90 + task_total_time_ms: 116 transform_count: 289 - transform_time_ms: 20 + transform_time_ms: 29 transform_yield_count: 67 insert_time_ms: 2 - insert_new_count: 118 + insert_new_count: 120 insert_reused_count: 7 - query: EXPLAIN select a, e from ta where e in ('b' + 'a' + 'r', 'doe') ref: in-predicate.yamsql:209 explain: ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(array(@c10 + @c12 - + @c14, @c16)) | FILTER q0.E EQUALS _ AS q1 RETURN (q0.A AS A, q0.E AS E) - } + + @c14, @c16)) | FILTER q0.E EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.E AS + E) } task_count: 939 - task_total_time_ms: 82 + task_total_time_ms: 101 transform_count: 289 - transform_time_ms: 20 + transform_time_ms: 29 transform_yield_count: 67 insert_time_ms: 2 - insert_new_count: 118 + insert_new_count: 120 insert_reused_count: 7 - query: EXPLAIN select a, b from ta where (a, b) in ((0L, 9L), (1L, 8L)) ref: in-predicate.yamsql:214 explain: ISCAN(F1 <,>) | FILTER (_.A AS A, _.B AS B) IN array((@c15 AS _0, @c17 AS _1), (@c21 AS _0, @c23 AS _1)) | MAP (_.A AS A, _.B AS B) task_count: 1122 - task_total_time_ms: 87 + task_total_time_ms: 137 transform_count: 316 - transform_time_ms: 26 + transform_time_ms: 34 transform_yield_count: 73 - insert_time_ms: 2 - insert_new_count: 144 + insert_time_ms: 3 + insert_new_count: 145 insert_reused_count: 5 - query: EXPLAIN select a, b from ta where f in ((90L, 9L), (81L, 18L)) ref: in-predicate.yamsql:219 explain: EXPLODE arrayDistinct(array((@c11 AS _0, @c13 AS _1), (@c17 AS _0, @c19 - AS _1))) | FLATMAP q0 -> { ISCAN(F1 [EQUALS promote(q0._0 AS LONG), EQUALS - promote(q0._1 AS LONG)]) AS q1 RETURN (q1.A AS A, q1.B AS B) } + AS _1))) | FLATMAP q0 -> { ISCAN(F1 [EQUALS q0._0._0, EQUALS q0._0._1]) AS + q1 RETURN (q1.A AS A, q1.B AS B) } task_count: 1009 - task_total_time_ms: 99 + task_total_time_ms: 123 transform_count: 295 - transform_time_ms: 27 + transform_time_ms: 39 transform_yield_count: 68 insert_time_ms: 2 - insert_new_count: 126 + insert_new_count: 127 insert_reused_count: 8 - query: EXPLAIN select a, b from ta where f in ((90L, 9L), (81L, 18L), (81L, 18L), (90L, 9L)) ref: in-predicate.yamsql:224 explain: EXPLODE arrayDistinct(array((@c11 AS _0, @c13 AS _1), (@c17 AS _0, @c19 AS _1), (@c17 AS _0, @c19 AS _1), (@c11 AS _0, @c13 AS _1))) | FLATMAP q0 - -> { ISCAN(F1 [EQUALS promote(q0._0 AS LONG), EQUALS promote(q0._1 AS LONG)]) - AS q1 RETURN (q1.A AS A, q1.B AS B) } + -> { ISCAN(F1 [EQUALS q0._0._0, EQUALS q0._0._1]) AS q1 RETURN (q1.A AS A, + q1.B AS B) } task_count: 1009 - task_total_time_ms: 92 + task_total_time_ms: 129 transform_count: 295 - transform_time_ms: 28 + transform_time_ms: 34 transform_yield_count: 68 - insert_time_ms: 2 - insert_new_count: 126 + insert_time_ms: 3 + insert_new_count: 127 insert_reused_count: 8 - query: EXPLAIN select e, a from ta where e not in ('foo' , 'bar', 'doe', 'arc', 'something') @@ -261,45 +266,46 @@ unnamed-2: insert_reused_count: 4 - query: EXPLAIN select a, e from ta where 1 in (2, 3) ref: in-predicate.yamsql:250 - explain: EXPLODE arrayDistinct(@c9) | FILTER @c7 EQUALS _ | FLATMAP q0 -> { ISCAN(F1 - <,>) AS q1 RETURN (q1.A AS A, q1.E AS E) } + explain: EXPLODE arrayDistinct(@c9) | FILTER @c7 EQUALS _._0 | FLATMAP q0 -> { + ISCAN(F1 <,>) AS q1 RETURN (q1.A AS A, q1.E AS E) } task_count: 941 - task_total_time_ms: 67 + task_total_time_ms: 103 transform_count: 260 - transform_time_ms: 18 + transform_time_ms: 28 transform_yield_count: 62 - insert_time_ms: 1 - insert_new_count: 118 + insert_time_ms: 2 + insert_new_count: 120 insert_reused_count: 6 - query: EXPLAIN select a from ta where 1 in (1, 2, 3) ref: in-predicate.yamsql:255 explain: 'EXPLODE arrayDistinct(@c7) | FLATMAP q0 -> { COVERING(F1 <,> -> [A: - KEY:[3], F: [SA: KEY:[0], SB: KEY:[1]]]) | FILTER @c5 EQUALS q0 | MAP (_.A + KEY:[3], F: [SA: KEY:[0], SB: KEY:[1]]]) | FILTER @c5 EQUALS q0._0 | MAP (_.A AS A) AS q1 RETURN q1 }' task_count: 993 - task_total_time_ms: 75 + task_total_time_ms: 71 transform_count: 265 - transform_time_ms: 15 + transform_time_ms: 16 transform_yield_count: 65 insert_time_ms: 2 - insert_new_count: 128 + insert_new_count: 130 insert_reused_count: 9 - query: EXPLAIN select id from array_table where exists (select 1 from array_table.fruits f where f = 'apple') ref: in-predicate.yamsql:261 - explain: 'COVERING(FRUITS [EQUALS @c17] -> [ID: KEY:[2]]) | MAP (_.ID AS ID)' - task_count: 457 - task_total_time_ms: 25 - transform_count: 136 - transform_time_ms: 7 - transform_yield_count: 34 + explain: 'COVERING(FRUITS [EQUALS promote(@c17 AS STRING)] -> [ID: KEY:[2]]) | + MAP (_.ID AS ID)' + task_count: 471 + task_total_time_ms: 30 + transform_count: 141 + transform_time_ms: 9 + transform_yield_count: 36 insert_time_ms: 0 - insert_new_count: 44 + insert_new_count: 48 insert_reused_count: 0 - query: EXPLAIN select id from array_table where 'apple' in fruits ref: in-predicate.yamsql:269 explain: SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.FRUITS) - | FILTER @c5 EQUALS _ AS q1 RETURN (q0.ID AS ID) } + | FILTER @c5 EQUALS _._0 AS q1 RETURN (q0.ID AS ID) } task_count: 341 task_total_time_ms: 21 transform_count: 114 @@ -311,7 +317,7 @@ unnamed-2: - query: EXPLAIN select id from array_table where 'banana' in fruits ref: in-predicate.yamsql:275 explain: SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.FRUITS) - | FILTER @c5 EQUALS _ AS q1 RETURN (q0.ID AS ID) } + | FILTER @c5 EQUALS _._0 AS q1 RETURN (q0.ID AS ID) } task_count: 341 task_total_time_ms: 21 transform_count: 114 @@ -323,7 +329,7 @@ unnamed-2: - query: EXPLAIN select id from array_table where 'pineapple' in fruits ref: in-predicate.yamsql:281 explain: SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.FRUITS) - | FILTER @c5 EQUALS _ AS q1 RETURN (q0.ID AS ID) } + | FILTER @c5 EQUALS _._0 AS q1 RETURN (q0.ID AS ID) } task_count: 341 task_total_time_ms: 21 transform_count: 114 @@ -336,8 +342,8 @@ unnamed-2: n where n = 10) ref: in-predicate.yamsql:287 explain: SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE q0.NUMBERS | FILTER - _ EQUALS promote(@c17 AS LONG) | MAP (@c8 AS _0) | DEFAULT NULL | FILTER _ - NOT_NULL AS q1 RETURN (q0.ID AS ID) } + _._0 EQUALS promote(@c17 AS LONG) | MAP (@c8 AS _0) | DEFAULT NULL | FILTER + _ NOT_NULL AS q1 RETURN (q0.ID AS ID) } task_count: 352 task_total_time_ms: 17 transform_count: 102 @@ -349,7 +355,7 @@ unnamed-2: - query: EXPLAIN select id from array_table where 10 in numbers ref: in-predicate.yamsql:294 explain: SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.NUMBERS) - | FILTER promote(@c5 AS LONG) EQUALS _ AS q1 RETURN (q0.ID AS ID) } + | FILTER promote(@c5 AS LONG) EQUALS _._0 AS q1 RETURN (q0.ID AS ID) } task_count: 341 task_total_time_ms: 19 transform_count: 114 @@ -361,7 +367,7 @@ unnamed-2: - query: EXPLAIN select id from array_table where 15 in numbers ref: in-predicate.yamsql:300 explain: SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.NUMBERS) - | FILTER promote(@c5 AS LONG) EQUALS _ AS q1 RETURN (q0.ID AS ID) } + | FILTER promote(@c5 AS LONG) EQUALS _._0 AS q1 RETURN (q0.ID AS ID) } task_count: 341 task_total_time_ms: 19 transform_count: 114 @@ -449,29 +455,29 @@ unnamed-2: explain: SCAN([IS T_PARENT, EQUALS promote(@c44 AS STRING)]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.LST) | FLATMAP q1 -> { [IN arrayDistinct(promote(@c50 AS ARRAY(LONG)))] | INJOIN q2 -> { SCAN([IS T_CHILD]) | FILTER _.T_LINK.NAME - EQUALS q0.ID AND _.NUM EQUALS q2 } | FILTER @c34 EQUALS q1 AS q3 RETURN q3 - } AS q4 RETURN (q4.ID AS CHILD_ID, q4.NUM AS NUM, q0.ID AS PARENT_ID) } + EQUALS q0.ID AND _.NUM EQUALS q2 } | FILTER @c34 EQUALS q1._0 AS q3 RETURN + q3 } AS q4 RETURN (q4.ID AS CHILD_ID, q4.NUM AS NUM, q0.ID AS PARENT_ID) } task_count: 9358 - task_total_time_ms: 983 + task_total_time_ms: 1067 transform_count: 4099 - transform_time_ms: 247 + transform_time_ms: 252 transform_yield_count: 514 - insert_time_ms: 167 - insert_new_count: 1394 + insert_time_ms: 187 + insert_new_count: 1426 insert_reused_count: 287 - query: EXPLAIN SELECT t.id, n FROM array_table AS t, t.numbers AS n WHERE n IN (10, 20) ref: in-predicate.yamsql:367 - explain: EXPLODE arrayDistinct(promote(@c19 AS ARRAY(LONG))) | FLATMAP q0 -> { - SCAN([IS ARRAY_TABLE]) | FLATMAP q1 -> { EXPLODE q1.NUMBERS | FILTER _ EQUALS - q0 AS q2 RETURN (q1.ID AS ID, q2 AS N) } AS q3 RETURN q3 } + explain: SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c19 + AS ARRAY(LONG))) | FLATMAP q1 -> { EXPLODE q0.NUMBERS | FILTER _._0 EQUALS + q1._0 AS q2 RETURN q2 } AS q2 RETURN (q0.ID AS ID, q2._0 AS N) } task_count: 1060 - task_total_time_ms: 71 - transform_count: 424 - transform_time_ms: 13 + task_total_time_ms: 90 + transform_count: 423 + transform_time_ms: 20 transform_yield_count: 54 - insert_time_ms: 3 - insert_new_count: 115 + insert_time_ms: 2 + insert_new_count: 117 insert_reused_count: 6 - query: EXPLAIN SELECT t.id, n, idx FROM array_table AS t, t.numbers AS n AT idx ref: in-predicate.yamsql:373 @@ -490,30 +496,30 @@ unnamed-2: ref: in-predicate.yamsql:385 explain: EXPLODE arrayDistinct(promote(@c23 AS ARRAY(LONG))) | FLATMAP q0 -> { SCAN([IS ARRAY_TABLE]) | FLATMAP q1 -> { EXPLODE q1.NUMBERS WITH ORDINALITY - | FILTER _._0 EQUALS q0 AS q2 RETURN (q1.ID AS ID, q2._0 AS N, q2._1 + 1 AS - IDX) } AS q3 RETURN q3 } - task_count: 1060 - task_total_time_ms: 82 - transform_count: 423 - transform_time_ms: 18 - transform_yield_count: 54 - insert_time_ms: 3 - insert_new_count: 115 + | FILTER _._0 EQUALS q0._0 AS q2 RETURN (q1.ID AS ID, q2._0 AS N, q2._1 + + 1 AS IDX) } AS q3 RETURN q3 } + task_count: 1049 + task_total_time_ms: 97 + transform_count: 422 + transform_time_ms: 21 + transform_yield_count: 53 + insert_time_ms: 2 + insert_new_count: 116 insert_reused_count: 6 - query: EXPLAIN SELECT t.id, n, idx FROM array_table AS t, t.numbers AS n AT idx WHERE idx IN (1, 3) ref: in-predicate.yamsql:394 explain: EXPLODE arrayDistinct(@c23) | FLATMAP q0 -> { SCAN([IS ARRAY_TABLE]) | FLATMAP q1 -> { EXPLODE q1.NUMBERS WITH ORDINALITY | FILTER _._1 + 1 EQUALS - q0 AS q2 RETURN (q1.ID AS ID, q2._0 AS N, q2._1 + 1 AS IDX) } AS q3 RETURN - q3 } + q0._0 AS q2 RETURN (q1 AS _0, q2 AS _1) } AS q3 RETURN (q3._0.ID AS ID, q3._1._0 + AS N, q3._1._1 + 1 AS IDX) } task_count: 1049 - task_total_time_ms: 71 + task_total_time_ms: 78 transform_count: 422 - transform_time_ms: 22 + transform_time_ms: 17 transform_yield_count: 53 - insert_time_ms: 3 - insert_new_count: 114 + insert_time_ms: 5 + insert_new_count: 116 insert_reused_count: 6 - query: EXPLAIN SELECT t.id, n, idx FROM array_table AS t, t.numbers AS n AT idx WHERE t.id IN (2, 4) @@ -522,25 +528,25 @@ unnamed-2: ARRAY_TABLE, EQUALS q0]) } | FLATMAP q1 -> { EXPLODE q1.NUMBERS WITH ORDINALITY AS q2 RETURN (q1.ID AS ID, q2._0 AS N, q2._1 + 1 AS IDX) }' task_count: 1166 - task_total_time_ms: 104 + task_total_time_ms: 92 transform_count: 454 - transform_time_ms: 29 + transform_time_ms: 27 transform_yield_count: 70 - insert_time_ms: 3 - insert_new_count: 140 + insert_time_ms: 2 + insert_new_count: 143 insert_reused_count: 9 - query: EXPLAIN SELECT t.id, f, idx FROM array_table AS t, t.fruits AS f AT idx WHERE f IN ('apple', 'mango') ref: in-predicate.yamsql:413 explain: EXPLODE arrayDistinct(@c23) | FLATMAP q0 -> { SCAN([IS ARRAY_TABLE]) - | FLATMAP q1 -> { EXPLODE q1.FRUITS WITH ORDINALITY | FILTER _._0 EQUALS q0 + | FLATMAP q1 -> { EXPLODE q1.FRUITS WITH ORDINALITY | FILTER _._0 EQUALS q0._0 AS q2 RETURN (q1.ID AS ID, q2._0 AS F, q2._1 + 1 AS IDX) } AS q3 RETURN q3 } - task_count: 1060 - task_total_time_ms: 78 - transform_count: 423 - transform_time_ms: 16 - transform_yield_count: 54 - insert_time_ms: 2 - insert_new_count: 115 + task_count: 1049 + task_total_time_ms: 110 + transform_count: 422 + transform_time_ms: 24 + transform_yield_count: 53 + insert_time_ms: 3 + insert_new_count: 116 insert_reused_count: 6 diff --git a/yaml-tests/src/test/resources/in-predicate.yamsql b/yaml-tests/src/test/resources/in-predicate.yamsql index 415a5732987..a3ebc79164f 100644 --- a/yaml-tests/src/test/resources/in-predicate.yamsql +++ b/yaml-tests/src/test/resources/in-predicate.yamsql @@ -69,12 +69,12 @@ test_block: - # LONG value matched against IN list of only LONG values - query: select a, b from ta where b in (1, 3, 5, 7) - - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) }" + - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) }" - unorderedResult: [{A: 2, 7}, {A: 4, 5}, {A: 6, 3}, {A: 8, 1}] - # LONG value matched against singleton IN list - query: select a, b from ta where b in (6) - - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) }" + - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) }" - result: [{A: 3, 6}] - # LONG value matched against empty IN list @@ -83,17 +83,17 @@ test_block: - # LONG value matched against IN list with no matches - query: select a, b from ta where b in (10, 33, 66) - - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) }" + - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) }" - result: [] - # LONG value matched against IN list of LONG-resultant arithmetic values - query: select a, b from ta where b in (1 + 0, 3 + 0, 5, 7) - - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(array(@c10 + @c12, @c14 + @c12, @c18, @c20) AS ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) }" + - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(array(@c10 + @c12, @c14 + @c12, @c18, @c20) AS ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) }" - unorderedResult: [{A: 2, 7}, {A: 4, 5}, {A: 6, 3}, {A: 8, 1}] - # LONG value matched against IN list of repeated LONG values - query: select a, b from ta where b in (1, 1, 1, 1) - - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) }" + - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) }" - initialVersionAtLeast: 4.6.4.0 - result: [{A: 8, 1}] # Duplicate values in in-lists lead to duplicate results if the IN predicate is planned as a nested loop join in earlier versions @@ -102,7 +102,7 @@ test_block: - # LONG value matched against IN list of repeated LONG values - query: select a, b from ta where b in (1, 2, 1, 3) - - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) }" + - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c9 AS ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) }" - initialVersionAtLeast: 4.6.4.0 - unorderedResult: [{A: 6, 3}, {A: 7, 2}, {A: 8, 1}] # Duplicate values in in-lists lead to duplicate results if the IN predicate is planned as a nested loop join in earlier versions @@ -111,7 +111,7 @@ test_block: - # LONG value matched against IN list of repeated LONG-resultant simple arithmetic values - query: select a, b from ta where b in (1 + 0, 1 + 0, 1 + 0, 1 + 0) - - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(array(@c10 + @c12, @c10 + @c12, @c10 + @c12, @c10 + @c12) AS ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) }" + - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(array(@c10 + @c12, @c10 + @c12, @c10 + @c12, @c10 + @c12) AS ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) }" - initialVersionAtLeast: 4.6.4.0 - result: [{A: 8, 1}] # Duplicate values in in-lists lead to duplicate results if the IN predicate is planned as a nested loop join in earlier versions @@ -120,7 +120,7 @@ test_block: - # LONG value matched against IN list of repeated LONG-resultant simple expressions - query: select a, b from ta where b in (1 + 0, 0 + 1) - - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(array(@c10 + @c12, @c12 + @c10) AS ARRAY(LONG))) | FILTER q0.B EQUALS _ AS q1 RETURN (q0.A AS A, q0.B AS B) }" + - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(array(@c10 + @c12, @c12 + @c10) AS ARRAY(LONG))) | FILTER q0.B EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.B AS B) }" - initialVersionAtLeast: 4.6.4.0 - result: [ { A: 8, 1 } ] # Duplicate values in in-lists lead to duplicate results if the IN predicate is planned as a nested loop join in earlier versions @@ -165,48 +165,48 @@ test_block: - # DOUBLE value matched against IN list of DOUBLE values - query: select a, c from ta where c in (4.56, 3.45, 2.34) - - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.C EQUALS _ AS q1 RETURN (q0.A AS A, q0.C AS C) }" + - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.C EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.C AS C) }" - unorderedResult: [{A: 1, 4.56}, {A: 4, 3.45}, {A: 7, 2.34}] - # DOUBLE value matched against singleton IN list of DOUBLE value - query: select a, c from ta where c in (9.01) - - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.C EQUALS _ AS q1 RETURN (q0.A AS A, q0.C AS C) }" + - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.C EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.C AS C) }" - result: [{A: 6, 9.01}] - # DOUBLE value matched against singleton IN list of DOUBLE-resultant simple expressions - query: select a, c from ta where c in (3.01 + 6) - - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(array(@c10 + @c12)) | FILTER q0.C EQUALS _ AS q1 RETURN (q0.A AS A, q0.C AS C) }" + - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(array(@c10 + @c12)) | FILTER q0.C EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.C AS C) }" - result: [{A: 6, 9.01}] - # BOOLEAN value matched against IN list of BOOLEAN values - query: select a, d from ta where d in (true, false) - - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.D EQUALS _ AS q1 RETURN (q0.A AS A, q0.D AS D) }" + - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.D EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.D AS D) }" - unorderedResult: [{A: 0, !ignore x}, {A: 2, !ignore x}, {A: 4, !ignore x}, {A: 6, !ignore x}, {A: 8, !ignore x}, {A: 1, !ignore x}, {A: 3, !ignore x}, {A: 5, !ignore x}, {A: 7, !ignore x}, {A: 9, !ignore x}] - # BOOLEAN value matched against singleton IN list of BOOLEAN values - query: select a, d from ta where d in (true) - - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.D EQUALS _ AS q1 RETURN (q0.A AS A, q0.D AS D) }" + - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.D EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.D AS D) }" - unorderedResult: [{A: 0, !ignore x}, {A: 2, !ignore x}, {A: 4, !ignore x}, {A: 6, !ignore x}, {A: 8, !ignore x}] - # BOOLEAN value matched against singleton IN list of BOOLEAN-resultant simple expressions - query: select a, d from ta where d in (3 < 4) - - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(array(@c10 lt @c12)) | FILTER q0.D EQUALS _ AS q1 RETURN (q0.A AS A, q0.D AS D) }" + - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(array(@c10 lt @c12)) | FILTER q0.D EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.D AS D) }" - unorderedResult: [{A: 0, !ignore x}, {A: 2, !ignore x}, {A: 4, !ignore x}, {A: 6, !ignore x}, {A: 8, !ignore x}] - # STRING value matched against IN list of STRING values - query: select a, e from ta where e in ('bar', 'doe') - - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.E EQUALS _ AS q1 RETURN (q0.A AS A, q0.E AS E) }" + - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.E EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.E AS E) }" - unorderedResult: [{ A: 1, !ignore x }, { A: 8, !ignore x }, { A: 2, !ignore x }, { A: 5, !ignore x }, { A: 9, !ignore x }] - # STRING value matched against singleton IN list of STRING values - query: select a, e from ta where e in ('foo') - - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.E EQUALS _ AS q1 RETURN (q0.A AS A, q0.E AS E) }" + - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(@c9) | FILTER q0.E EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.E AS E) }" - unorderedResult: [ { A: 0, !ignore x }, { A: 6, !ignore x }] - # STRING value matched against IN list of BOOLEAN-resultant simple expressions - query: select a, e from ta where e in ('b' + 'a' + 'r', 'doe') - - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(array(@c10 + @c12 + @c14, @c16)) | FILTER q0.E EQUALS _ AS q1 RETURN (q0.A AS A, q0.E AS E) }" + - explain: "ISCAN(F1 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(array(@c10 + @c12 + @c14, @c16)) | FILTER q0.E EQUALS _._0 AS q1 RETURN (q0.A AS A, q0.E AS E) }" - unorderedResult: [{ A: 1, !ignore x }, { A: 8, !ignore x }, { A: 2, !ignore x }, { A: 5, !ignore x }, { A: 9, !ignore x }] - # struct value matched against IN list of Tuple values @@ -216,12 +216,12 @@ test_block: - # struct column with an index matched against IN list of Tuple values - query: select a, b from ta where f in ((90L, 9L), (81L, 18L)) - - explain: "EXPLODE arrayDistinct(array((@c11 AS _0, @c13 AS _1), (@c17 AS _0, @c19 AS _1))) | FLATMAP q0 -> { ISCAN(F1 [EQUALS promote(q0._0 AS LONG), EQUALS promote(q0._1 AS LONG)]) AS q1 RETURN (q1.A AS A, q1.B AS B) }" + - explain: "EXPLODE arrayDistinct(array((@c11 AS _0, @c13 AS _1), (@c17 AS _0, @c19 AS _1))) | FLATMAP q0 -> { ISCAN(F1 [EQUALS q0._0._0, EQUALS q0._0._1]) AS q1 RETURN (q1.A AS A, q1.B AS B) }" - unorderedResult: [ { A: 0, 9 }, { A: 1, 8 } ] - # struct column with an index matched against IN list of repeated Tuple values - query: select a, b from ta where f in ((90L, 9L), (81L, 18L), (81L, 18L), (90L, 9L)) - - explain: "EXPLODE arrayDistinct(array((@c11 AS _0, @c13 AS _1), (@c17 AS _0, @c19 AS _1), (@c17 AS _0, @c19 AS _1), (@c11 AS _0, @c13 AS _1))) | FLATMAP q0 -> { ISCAN(F1 [EQUALS promote(q0._0 AS LONG), EQUALS promote(q0._1 AS LONG)]) AS q1 RETURN (q1.A AS A, q1.B AS B) }" + - explain: "EXPLODE arrayDistinct(array((@c11 AS _0, @c13 AS _1), (@c17 AS _0, @c19 AS _1), (@c17 AS _0, @c19 AS _1), (@c11 AS _0, @c13 AS _1))) | FLATMAP q0 -> { ISCAN(F1 [EQUALS q0._0._0, EQUALS q0._0._1]) AS q1 RETURN (q1.A AS A, q1.B AS B) }" - initialVersionAtLeast: 4.6.4.0 - unorderedResult: [ { A: 0, 9 }, { A: 1, 8 } ] # Duplicate values in in-lists lead to duplicate results if the IN predicate is planned as a nested loop join in earlier versions @@ -247,18 +247,18 @@ test_block: - # constant LONG value matched against IN list of LONG values - query: select a, e from ta where 1 in (2, 3) - - explain: "EXPLODE arrayDistinct(@c9) | FILTER @c7 EQUALS _ | FLATMAP q0 -> { ISCAN(F1 <,>) AS q1 RETURN (q1.A AS A, q1.E AS E) }" + - explain: "EXPLODE arrayDistinct(@c9) | FILTER @c7 EQUALS _._0 | FLATMAP q0 -> { ISCAN(F1 <,>) AS q1 RETURN (q1.A AS A, q1.E AS E) }" - result: [] - # constant LONG value matched against IN list of LONG values. - query: select a from ta where 1 in (1, 2, 3) - - explain: "EXPLODE arrayDistinct(@c7) | FLATMAP q0 -> { COVERING(F1 <,> -> [A: KEY:[3], F: [SA: KEY:[0], SB: KEY:[1]]]) | FILTER @c5 EQUALS q0 | MAP (_.A AS A) AS q1 RETURN q1 }" + - explain: "EXPLODE arrayDistinct(@c7) | FLATMAP q0 -> { COVERING(F1 <,> -> [A: KEY:[3], F: [SA: KEY:[0], SB: KEY:[1]]]) | FILTER @c5 EQUALS q0._0 | MAP (_.A AS A) AS q1 RETURN q1 }" - unorderedResult: [{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}] - # Test alternate IN-like predicate with primitive array column - string in string array - query: select id from array_table where exists (select 1 from array_table.fruits f where f = 'apple') - supported_version: 4.8.1.0 - - explain: "COVERING(FRUITS [EQUALS @c17] -> [ID: KEY:[2]]) | MAP (_.ID AS ID)" + - explain: "COVERING(FRUITS [EQUALS promote(@c17 AS STRING)] -> [ID: KEY:[2]]) | MAP (_.ID AS ID)" - unorderedResult: [{1}, {3}] - # Test IN predicate with primitive array column - string in string array @@ -266,38 +266,38 @@ test_block: - supported_version: 4.8.1.0 # Note: this should be able to match the "fruits" index like the above query, but it does not # See: https://github.com/FoundationDB/fdb-record-layer/issues/3777 - - explain: "SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.FRUITS) | FILTER @c5 EQUALS _ AS q1 RETURN (q0.ID AS ID) }" + - explain: "SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.FRUITS) | FILTER @c5 EQUALS _._0 AS q1 RETURN (q0.ID AS ID) }" - unorderedResult: [{1}, {3}] - # Test IN predicate with primitive array column - multiple matches - query: select id from array_table where 'banana' in fruits - supported_version: 4.8.1.0 - - explain: "SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.FRUITS) | FILTER @c5 EQUALS _ AS q1 RETURN (q0.ID AS ID) }" + - explain: "SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.FRUITS) | FILTER @c5 EQUALS _._0 AS q1 RETURN (q0.ID AS ID) }" - unorderedResult: [{1}, {5}] - # Test IN predicate with primitive array column - no match - query: select id from array_table where 'pineapple' in fruits - supported_version: 4.8.1.0 - - explain: "SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.FRUITS) | FILTER @c5 EQUALS _ AS q1 RETURN (q0.ID AS ID) }" + - explain: "SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.FRUITS) | FILTER @c5 EQUALS _._0 AS q1 RETURN (q0.ID AS ID) }" - result: [] - # Test alternate IN-like predicate with primitive array column - int in int array - query: select id from array_table where exists (select 1 from array_table.numbers n where n = 10) - supported_version: 4.8.1.0 - - explain: "SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE q0.NUMBERS | FILTER _ EQUALS promote(@c17 AS LONG) | MAP (@c8 AS _0) | DEFAULT NULL | FILTER _ NOT_NULL AS q1 RETURN (q0.ID AS ID) }" + - explain: "SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE q0.NUMBERS | FILTER _._0 EQUALS promote(@c17 AS LONG) | MAP (@c8 AS _0) | DEFAULT NULL | FILTER _ NOT_NULL AS q1 RETURN (q0.ID AS ID) }" - unorderedResult: [{1}, {3}] - # Test IN predicate with primitive array column - bigint in bigint array - query: select id from array_table where 10 in numbers - supported_version: 4.8.1.0 # Note: as there is no index on the numbers field, this is the expected plan. Ideally, the previous query would also have the same plan as this one - - explain: "SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.NUMBERS) | FILTER promote(@c5 AS LONG) EQUALS _ AS q1 RETURN (q0.ID AS ID) }" + - explain: "SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.NUMBERS) | FILTER promote(@c5 AS LONG) EQUALS _._0 AS q1 RETURN (q0.ID AS ID) }" - unorderedResult: [{1}, {3}] - # Test IN predicate with primitive array column - bigint no match - query: select id from array_table where 15 in numbers - supported_version: 4.8.1.0 - - explain: "SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.NUMBERS) | FILTER promote(@c5 AS LONG) EQUALS _ AS q1 RETURN (q0.ID AS ID) }" + - explain: "SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.NUMBERS) | FILTER promote(@c5 AS LONG) EQUALS _._0 AS q1 RETURN (q0.ID AS ID) }" - result: [] - # Test IN predicate with record array column - struct in struct array @@ -353,7 +353,7 @@ test_block: AND t_parent.id = 'p1' AND t_child.num IN (1, 2, 3) - supported_version: 4.12.5.0 - - explain: "SCAN([IS T_PARENT, EQUALS promote(@c44 AS STRING)]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.LST) | FLATMAP q1 -> { [IN arrayDistinct(promote(@c50 AS ARRAY(LONG)))] | INJOIN q2 -> { SCAN([IS T_CHILD]) | FILTER _.T_LINK.NAME EQUALS q0.ID AND _.NUM EQUALS q2 } | FILTER @c34 EQUALS q1 AS q3 RETURN q3 } AS q4 RETURN (q4.ID AS CHILD_ID, q4.NUM AS NUM, q0.ID AS PARENT_ID) }" + - explain: "SCAN([IS T_PARENT, EQUALS promote(@c44 AS STRING)]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.LST) | FLATMAP q1 -> { [IN arrayDistinct(promote(@c50 AS ARRAY(LONG)))] | INJOIN q2 -> { SCAN([IS T_CHILD]) | FILTER _.T_LINK.NAME EQUALS q0.ID AND _.NUM EQUALS q2 } | FILTER @c34 EQUALS q1._0 AS q3 RETURN q3 } AS q4 RETURN (q4.ID AS CHILD_ID, q4.NUM AS NUM, q0.ID AS PARENT_ID) }" - unorderedResult: [ { child_id: 'c1', num: 1, parent_id: 'p1' }, { child_id: 'c2', num: 2, parent_id: 'p1' } @@ -364,7 +364,7 @@ test_block: # unnested numbers array), which previously caused SplitSelectExtractIndependentQuantifiersRule to throw. - query: SELECT t.id, n FROM array_table AS t, t.numbers AS n WHERE n IN (10, 20) - supported_version: 4.12.5.0 - - explain: "EXPLODE arrayDistinct(promote(@c19 AS ARRAY(LONG))) | FLATMAP q0 -> { SCAN([IS ARRAY_TABLE]) | FLATMAP q1 -> { EXPLODE q1.NUMBERS | FILTER _ EQUALS q0 AS q2 RETURN (q1.ID AS ID, q2 AS N) } AS q3 RETURN q3 }" + - explain: "SCAN([IS ARRAY_TABLE]) | FLATMAP q0 -> { EXPLODE arrayDistinct(promote(@c19 AS ARRAY(LONG))) | FLATMAP q1 -> { EXPLODE q0.NUMBERS | FILTER _._0 EQUALS q1._0 AS q2 RETURN q2 } AS q2 RETURN (q0.ID AS ID, q2._0 AS N) }" - unorderedResult: [{ID: 1, N: 10}, {ID: 1, N: 20}, {ID: 3, N: 10}, {ID: 5, N: 20}] - # PartiQL join AT on bigint array: unnest numbers with ordinal position. @@ -382,7 +382,7 @@ test_block: # The ordinal (IDX) reflects the position in the original array, not the rank among filtered rows. - query: SELECT t.id, n, idx FROM array_table AS t, t.numbers AS n AT idx WHERE n IN (10, 20) - supported_version: 4.12.5.0 - - explain: "EXPLODE arrayDistinct(promote(@c23 AS ARRAY(LONG))) | FLATMAP q0 -> { SCAN([IS ARRAY_TABLE]) | FLATMAP q1 -> { EXPLODE q1.NUMBERS WITH ORDINALITY | FILTER _._0 EQUALS q0 AS q2 RETURN (q1.ID AS ID, q2._0 AS N, q2._1 + 1 AS IDX) } AS q3 RETURN q3 }" + - explain: "EXPLODE arrayDistinct(promote(@c23 AS ARRAY(LONG))) | FLATMAP q0 -> { SCAN([IS ARRAY_TABLE]) | FLATMAP q1 -> { EXPLODE q1.NUMBERS WITH ORDINALITY | FILTER _._0 EQUALS q0._0 AS q2 RETURN (q1.ID AS ID, q2._0 AS N, q2._1 + 1 AS IDX) } AS q3 RETURN q3 }" - unorderedResult: [ {ID: 1, N: 10, IDX: 1}, {ID: 1, N: 20, IDX: 2}, {ID: 3, N: 10, IDX: 1}, @@ -391,7 +391,7 @@ test_block: # PartiQL join AT on bigint array with IN predicate on the ordinal. - query: SELECT t.id, n, idx FROM array_table AS t, t.numbers AS n AT idx WHERE idx IN (1, 3) - supported_version: 4.12.5.0 - - explain: "EXPLODE arrayDistinct(@c23) | FLATMAP q0 -> { SCAN([IS ARRAY_TABLE]) | FLATMAP q1 -> { EXPLODE q1.NUMBERS WITH ORDINALITY | FILTER _._1 + 1 EQUALS q0 AS q2 RETURN (q1.ID AS ID, q2._0 AS N, q2._1 + 1 AS IDX) } AS q3 RETURN q3 }" + - explain: "EXPLODE arrayDistinct(@c23) | FLATMAP q0 -> { SCAN([IS ARRAY_TABLE]) | FLATMAP q1 -> { EXPLODE q1.NUMBERS WITH ORDINALITY | FILTER _._1 + 1 EQUALS q0._0 AS q2 RETURN (q1 AS _0, q2 AS _1) } AS q3 RETURN (q3._0.ID AS ID, q3._1._0 AS N, q3._1._1 + 1 AS IDX) }" - unorderedResult: [ {ID: 1, N: 10, IDX: 1}, {ID: 1, N: 30, IDX: 3}, {ID: 2, N: 40, IDX: 1}, @@ -410,7 +410,7 @@ test_block: # PartiQL join AT on string array with IN predicate on the unnested value. - query: SELECT t.id, f, idx FROM array_table AS t, t.fruits AS f AT idx WHERE f IN ('apple', 'mango') - supported_version: 4.12.5.0 - - explain: "EXPLODE arrayDistinct(@c23) | FLATMAP q0 -> { SCAN([IS ARRAY_TABLE]) | FLATMAP q1 -> { EXPLODE q1.FRUITS WITH ORDINALITY | FILTER _._0 EQUALS q0 AS q2 RETURN (q1.ID AS ID, q2._0 AS F, q2._1 + 1 AS IDX) } AS q3 RETURN q3 }" + - explain: "EXPLODE arrayDistinct(@c23) | FLATMAP q0 -> { SCAN([IS ARRAY_TABLE]) | FLATMAP q1 -> { EXPLODE q1.FRUITS WITH ORDINALITY | FILTER _._0 EQUALS q0._0 AS q2 RETURN (q1.ID AS ID, q2._0 AS F, q2._1 + 1 AS IDX) } AS q3 RETURN q3 }" - unorderedResult: [ {ID: 1, F: 'apple', IDX: 1}, {ID: 3, F: 'apple', IDX: 1}, {ID: 3, F: 'mango', IDX: 3}] diff --git a/yaml-tests/src/test/resources/join-tests.metrics.binpb b/yaml-tests/src/test/resources/join-tests.metrics.binpb index 9483bbd7bb7..88e1183e396 100644 --- a/yaml-tests/src/test/resources/join-tests.metrics.binpb +++ b/yaml-tests/src/test/resources/join-tests.metrics.binpb @@ -531,65 +531,65 @@ join-tests ¤ join-tests•EXPLAIN select dept.id, dept.name, project.name from emp, dept, project where emp.dept_id = dept.id and project.emp_id = emp.id and dept.id in (1, 2)Ÿ6 -"°«åÖî¿°? Ù¾¢š(¹ 0Ÿ´Ù�8ï@™Õ[IN arrayDistinct(promote(@c39 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS DEPT, EQUALS q0]) | FLATMAP q1 -> { SCAN([IS PROJECT]) | FLATMAP q2 -> { COVERING(EMPDEPT [EQUALS q1.ID] -> [DEPT_ID: KEY:[0], ID: KEY:[2]]) | FILTER q2.EMP_ID EQUALS _.ID | MAP (1 AS _0) AS q3 RETURN q2 } AS q2 RETURN (q1.ID AS ID, q1.NAME AS _1, q2.NAME AS _2) } } 3digraph G { +"°«¡÷ľ°? íÍ´û(¹ 0¶ÞÇŽ8­@™Õ[IN arrayDistinct(promote(@c39 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS DEPT, EQUALS q0]) | FLATMAP q1 -> { SCAN([IS PROJECT]) | FLATMAP q2 -> { COVERING(EMPDEPT [EQUALS q1.ID] -> [DEPT_ID: KEY:[0], ID: KEY:[2]]) | FILTER q2.EMP_ID EQUALS _.ID | MAP (1 AS _0) AS q3 RETURN q2 } AS q2 RETURN (q1.ID AS ID, q1.NAME AS _1, q2.NAME AS _2) } } 3digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS ID, STRING AS _1, STRING AS _2)" ]; 2 [ label=<
Nested Loop Join
FLATMAP (q6.ID AS ID, q6.NAME AS _1, q10.NAME AS _2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS _1, STRING AS _2)" ]; - 3 [ label=<
Nested Loop Join
FLATMAP q10
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, STRING AS DSC, LONG AS EMP_ID)" ]; - 4 [ label=<
Scan
comparisons: [IS DEPT, EQUALS q1632]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; - 5 [ label=<
Scan
comparisons: [IS PROJECT]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, STRING AS DSC, LONG AS EMP_ID)" ]; - 6 [ label=<
Value Computation
MAP (1 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _0)" ]; - 7 [ label=<
Primary Storage
record types: [A, PROJECT, B, JUB, JA, JUA, JB, JUD, EMP, JD, DEPT]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; + 3 [ label=<
Scan
comparisons: [IS DEPT, EQUALS q1707]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; + 4 [ label=<
Nested Loop Join
FLATMAP q10
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, STRING AS DSC, LONG AS EMP_ID)" ]; + 5 [ label=<
Primary Storage
record types: [A, PROJECT, B, JUB, JA, JUA, JB, JUD, EMP, JD, DEPT]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; + 6 [ label=<
Scan
comparisons: [IS PROJECT]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, STRING AS DSC, LONG AS EMP_ID)" ]; + 7 [ label=<
Value Computation
MAP (1 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _0)" ]; 8 [ label=<
Primary Storage
record types: [A, PROJECT, B, JUB, JA, JUA, JB, JUD, EMP, JD, DEPT]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, STRING AS DSC, LONG AS EMP_ID)" ]; - 9 [ label=<
Predicate Filter
WHERE q10.EMP_ID EQUALS q1168.ID
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS FNAME, STRING AS LNAME, LONG AS DEPT_ID)" ]; + 9 [ label=<
Predicate Filter
WHERE q10.EMP_ID EQUALS q1219.ID
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS FNAME, STRING AS LNAME, LONG AS DEPT_ID)" ]; 10 [ label=<
Covering Index Scan
comparisons: [EQUALS q6.ID]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS FNAME, STRING AS LNAME, LONG AS DEPT_ID)" ]; 11 [ label=<
Index
EMPDEPT
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS FNAME, STRING AS LNAME, LONG AS DEPT_ID)" ]; 12 [ label=<
Table Function
EXPLODE(arrayDistinct(promote(@c39 AS ARRAY(LONG))))
> color="black" shape="plain" style="filled" fillcolor="darkseagreen2" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS _1, STRING AS _2)" ]; - 3 -> 2 [ label=< q10> label="q10" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 4 -> 2 [ label=< q6> label="q6" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 5 -> 3 [ label=< q10> label="q10" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 6 -> 3 [ label=< q77> label="q77" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 7 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 8 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 9 -> 6 [ label=< q1173> label="q1173" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 10 -> 9 [ label=< q1168> label="q1168" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 3 -> 2 [ label=< q6> label="q6" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 2 [ label=< q10> label="q10" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 4 [ label=< q10> label="q10" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 4 [ label=< q77> label="q77" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 7 [ label=< q1224> label="q1224" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 9 [ label=< q1219> label="q1219" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 11 -> 10 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 12 -> 1 [ color="black" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ color="black" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; { - 10 -> 2 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + rank=same; + rankDir=LR; + 12 -> 2 [ color="red" style="invis" ]; } { - 9 -> 2 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 10 -> 2 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { - 3 -> 2 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 9 -> 2 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { - rank=same; - rankDir=LR; - 4 -> 3 [ color="red" style="invis" ]; + 4 -> 2 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { rank=same; rankDir=LR; - 12 -> 2 [ color="red" style="invis" ]; + 3 -> 4 [ color="red" style="invis" ]; } { - 9 -> 3 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 9 -> 4 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { rank=same; rankDir=LR; - 5 -> 6 [ color="red" style="invis" ]; + 6 -> 7 [ color="red" style="invis" ]; } }š' „ join-testsvEXPLAIN select emp.id, fname from emp, dept where emp.dept_id = dept.id and dept.id in (1, 2) and emp.id not in (1, 5)�& -ñ0²ñîôÑ ©ë……(ð0½Ë�8È@Až[IN arrayDistinct(promote(@c23 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS DEPT, EQUALS q0]) } | FLATMAP q1 -> { COVERING(EMPDEPT [EQUALS q1.ID] -> [DEPT_ID: KEY:[0], ID: KEY:[2]]) | FILTER NOT _.ID IN promote(@c34 AS ARRAY(LONG)) | FETCH AS q2 RETURN (q2.ID AS ID, q2.FNAME AS FNAME) }Ë#digraph G { +ñ0ù·ä§Ñ ¨Ê±Î(ð0�¨ë$8Ô@Až[IN arrayDistinct(promote(@c23 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS DEPT, EQUALS q0]) } | FLATMAP q1 -> { COVERING(EMPDEPT [EQUALS q1.ID] -> [DEPT_ID: KEY:[0], ID: KEY:[2]]) | FILTER NOT _.ID IN promote(@c34 AS ARRAY(LONG)) | FETCH AS q2 RETURN (q2.ID AS ID, q2.FNAME AS FNAME) }Ë#digraph G { fontname=courier; rankdir=BT; splines=line; @@ -610,24 +610,24 @@ join-testsvEXPLAIN select emp.id, fname from emp, dept where emp.dept_id = dept 8 -> 7 [ label=< q147> label="q147" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 9 -> 8 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - { - 8 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; - } { rank=same; rankDir=LR; - 2 -> 6 [ color="red" style="invis" ]; + 3 -> 4 [ color="red" style="invis" ]; + } + { + 8 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { rank=same; rankDir=LR; - 3 -> 4 [ color="red" style="invis" ]; + 2 -> 6 [ color="red" style="invis" ]; } }Ä' „ join-testsvEXPLAIN select emp.id, fname from emp, dept where dept.id = emp.dept_id and dept.id in (1, 2) and emp.id not in (1, 5)º& -ê)Ø¥„ïÖ ÙŽ…g(¿0¢Ð¹8ò@<®[IN arrayDistinct(promote(@c23 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS DEPT, EQUALS q0]) } | FLATMAP q1 -> { COVERING(EMPDEPT <,> -> [DEPT_ID: KEY:[0], ID: KEY:[2]]) | FILTER NOT _.ID IN promote(@c34 AS ARRAY(LONG)) AND q1.ID EQUALS _.DEPT_ID | FETCH AS q2 RETURN (q2.ID AS ID, q2.FNAME AS FNAME) }æ#digraph G { +ê)ôÊ·¥Ö ­ùò{(¿0§‡ü&8ý@<®[IN arrayDistinct(promote(@c23 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS DEPT, EQUALS q0]) } | FLATMAP q1 -> { COVERING(EMPDEPT <,> -> [DEPT_ID: KEY:[0], ID: KEY:[2]]) | FILTER NOT _.ID IN promote(@c34 AS ARRAY(LONG)) AND q1.ID EQUALS _.DEPT_ID | FETCH AS q2 RETURN (q2.ID AS ID, q2.FNAME AS FNAME) }æ#digraph G { fontname=courier; rankdir=BT; splines=line; @@ -665,7 +665,7 @@ join-testsvEXPLAIN select emp.id, fname from emp, dept where dept.id = emp.dept y join-testskEXPLAIN select emp.id from emp, dept where emp.dept_id = dept.id and dept.id = 1 and emp.id in (10, 20, 30)Ö" -â3¬´ž™ú û½ö…(–0¨«ù8À @<ÚSCAN([IS DEPT, EQUALS promote(@c21 AS LONG)]) | FLATMAP q0 -> { [IN arrayDistinct(promote(@c27 AS ARRAY(LONG)))] | INJOIN q1 -> { SCAN([IS EMP, EQUALS q1]) | FILTER _.DEPT_ID EQUALS q0.ID } AS q2 RETURN (q2.ID AS ID) }Õ digraph G { +â3Æî‹éú íŠÂ²(–0Ùóò 8Î @<ÚSCAN([IS DEPT, EQUALS promote(@c21 AS LONG)]) | FLATMAP q0 -> { [IN arrayDistinct(promote(@c27 AS ARRAY(LONG)))] | INJOIN q1 -> { SCAN([IS EMP, EQUALS q1]) | FILTER _.DEPT_ID EQUALS q0.ID } AS q2 RETURN (q2.ID AS ID) }Õ digraph G { fontname=courier; rankdir=BT; splines=line; @@ -673,29 +673,29 @@ join-testskEXPLAIN select emp.id from emp, dept where emp.dept_id = dept.id and 2 [ label=<
Scan
comparisons: [IS DEPT, EQUALS promote(@c21 AS LONG)]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; 3 [ label=<
Primary Storage
record types: [A, PROJECT, B, JUB, JA, JUA, JB, JUD, EMP, JD, DEPT]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; 4 [ label=<
Nested Loop Join
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS ID, STRING AS FNAME, STRING AS LNAME, LONG AS DEPT_ID)" ]; - 5 [ label=<
Predicate Filter
WHERE q2.DEPT_ID EQUALS q6.ID
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS FNAME, STRING AS LNAME, LONG AS DEPT_ID)" ]; - 6 [ label=<
Table Function
EXPLODE(arrayDistinct(promote(@c27 AS ARRAY(LONG))))
> color="black" shape="plain" style="filled" fillcolor="darkseagreen2" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS FNAME, STRING AS LNAME, LONG AS DEPT_ID)" ]; - 7 [ label=<
Scan
comparisons: [IS EMP, EQUALS q408]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS FNAME, STRING AS LNAME, LONG AS DEPT_ID)" ]; + 5 [ label=<
Table Function
EXPLODE(arrayDistinct(promote(@c27 AS ARRAY(LONG))))
> color="black" shape="plain" style="filled" fillcolor="darkseagreen2" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS FNAME, STRING AS LNAME, LONG AS DEPT_ID)" ]; + 6 [ label=<
Predicate Filter
WHERE q2.DEPT_ID EQUALS q6.ID
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS FNAME, STRING AS LNAME, LONG AS DEPT_ID)" ]; + 7 [ label=<
Scan
comparisons: [IS EMP, EQUALS q415]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS FNAME, STRING AS LNAME, LONG AS DEPT_ID)" ]; 8 [ label=<
Primary Storage
record types: [A, PROJECT, B, JUB, JA, JUA, JB, JUD, EMP, JD, DEPT]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS FNAME, STRING AS LNAME, LONG AS DEPT_ID)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ color="black" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 4 [ color="black" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 7 -> 5 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 8 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 4 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; { - rank=same; - rankDir=LR; - 6 -> 5 [ color="red" style="invis" ]; + 6 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { - 5 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + rank=same; + rankDir=LR; + 2 -> 4 [ color="red" style="invis" ]; } { rank=same; rankDir=LR; - 2 -> 4 [ color="red" style="invis" ]; + 5 -> 6 [ color="red" style="invis" ]; } }Ù( K @@ -1496,41 +1496,46 @@ join-tests:EXPLAIN select ja.c1, ja.c2, jb.c3 from ja, jb where null; rankDir=LR; 7 -> 8 [ color="red" style="invis" ]; } -}¨3 +}§3 ¼ -"three-way-joins-right-deep-planner•EXPLAIN select dept.id, dept.name, project.name from emp, dept, project where emp.dept_id = dept.id and project.emp_id = emp.id and dept.id in (1, 2)æ1 -úD ÉõÖ× Ê¥Åb(�0÷×8— @nŸ[IN arrayDistinct(promote(@c39 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS DEPT, EQUALS q0]) } | FLATMAP q1 -> { ISCAN(EMPDEPT [EQUALS q1.ID]) | FLATMAP q2 -> { SCAN([IS PROJECT]) | FILTER _.EMP_ID EQUALS q2.ID AS q3 RETURN q3 } AS q3 RETURN (q1.ID AS ID, q1.NAME AS _1, q3.NAME AS _2) }¡/digraph G { +"three-way-joins-right-deep-planner•EXPLAIN select dept.id, dept.name, project.name from emp, dept, project where emp.dept_id = dept.id and project.emp_id = emp.id and dept.id in (1, 2)å1 +úDÖþœ‘× ‰»ùt(�0„ö¢8© @nŸ[IN arrayDistinct(promote(@c39 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS DEPT, EQUALS q0]) } | FLATMAP q1 -> { ISCAN(EMPDEPT [EQUALS q1.ID]) | FLATMAP q2 -> { SCAN([IS PROJECT]) | FILTER _.EMP_ID EQUALS q2.ID AS q3 RETURN q3 } AS q3 RETURN (q1.ID AS ID, q1.NAME AS _1, q3.NAME AS _2) } /digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q6.ID AS ID, q6.NAME AS _1, q10.NAME AS _2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS _1, STRING AS _2)" ]; 2 [ label=<
Nested Loop Join
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; - 3 [ label=<
Scan
comparisons: [IS DEPT, EQUALS q441]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; - 4 [ label=<
Table Function
EXPLODE(arrayDistinct(promote(@c39 AS ARRAY(LONG))))
> color="black" shape="plain" style="filled" fillcolor="darkseagreen2" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; + 3 [ label=<
Table Function
EXPLODE(arrayDistinct(promote(@c39 AS ARRAY(LONG))))
> color="black" shape="plain" style="filled" fillcolor="darkseagreen2" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; + 4 [ label=<
Scan
comparisons: [IS DEPT, EQUALS q451]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; 5 [ label=<
Primary Storage
record types: [A, PROJECT, B, JUB, JA, JUA, JB, JUD, EMP, JD, DEPT]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; 6 [ label=<
Nested Loop Join
FLATMAP q10
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, STRING AS DSC, LONG AS EMP_ID)" ]; - 7 [ label=<
Index Scan
comparisons: [EQUALS q6.ID]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS FNAME, STRING AS LNAME, LONG AS DEPT_ID)" ]; - 8 [ label=<
Predicate Filter
WHERE q10.EMP_ID EQUALS q2.ID
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, STRING AS DSC, LONG AS EMP_ID)" ]; - 9 [ label=<
Index
EMPDEPT
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS FNAME, STRING AS LNAME, LONG AS DEPT_ID)" ]; - 10 [ label=<
Scan
comparisons: [IS PROJECT]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, STRING AS DSC, LONG AS EMP_ID)" ]; + 7 [ label=<
Predicate Filter
WHERE q10.EMP_ID EQUALS q2.ID
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, STRING AS DSC, LONG AS EMP_ID)" ]; + 8 [ label=<
Index Scan
comparisons: [EQUALS q6.ID]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS FNAME, STRING AS LNAME, LONG AS DEPT_ID)" ]; + 9 [ label=<
Scan
comparisons: [IS PROJECT]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, STRING AS DSC, LONG AS EMP_ID)" ]; + 10 [ label=<
Index
EMPDEPT
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS FNAME, STRING AS LNAME, LONG AS DEPT_ID)" ]; 11 [ label=<
Primary Storage
record types: [A, PROJECT, B, JUB, JA, JUA, JB, JUD, EMP, JD, DEPT]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, STRING AS DSC, LONG AS EMP_ID)" ]; 3 -> 2 [ color="black" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 4 -> 2 [ color="black" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 5 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q6> label="q6" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 7 -> 6 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 8 -> 6 [ label=< q10> label="q10" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 9 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 10 -> 8 [ label=< q10> label="q10" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 11 -> 10 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q10> label="q10" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 6 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 7 [ label=< q10> label="q10" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 8 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 11 -> 9 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 1 [ label=< q10> label="q10" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; { - 8 -> 6 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 7 -> 6 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { rank=same; rankDir=LR; - 7 -> 8 [ color="red" style="invis" ]; + 8 -> 7 [ color="red" style="invis" ]; + } + { + rank=same; + rankDir=LR; + 3 -> 4 [ color="red" style="invis" ]; } { 7 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; @@ -1546,11 +1551,6 @@ join-tests:EXPLAIN select ja.c1, ja.c2, jb.c3 from ja, jb where null; rankDir=LR; 2 -> 6 [ color="red" style="invis" ]; } - { - rank=same; - rankDir=LR; - 4 -> 3 [ color="red" style="invis" ]; - } }ð( c "three-way-joins-right-deep-planner=EXPLAIN select * from ja join jb using(c1) join jd using(c1);ˆ( diff --git a/yaml-tests/src/test/resources/join-tests.metrics.yaml b/yaml-tests/src/test/resources/join-tests.metrics.yaml index 64628e5c5ec..935892555e4 100644 --- a/yaml-tests/src/test/resources/join-tests.metrics.yaml +++ b/yaml-tests/src/test/resources/join-tests.metrics.yaml @@ -193,12 +193,12 @@ join-tests: _.ID | MAP (1 AS _0) AS q3 RETURN q2 } AS q2 RETURN (q1.ID AS ID, q1.NAME AS _1, q2.NAME AS _2) } }' task_count: 21936 - task_total_time_ms: 2281 + task_total_time_ms: 2010 transform_count: 8112 - transform_time_ms: 591 + transform_time_ms: 527 transform_yield_count: 1209 - insert_time_ms: 301 - insert_new_count: 3823 + insert_time_ms: 298 + insert_new_count: 3885 insert_reused_count: 409 - query: EXPLAIN select emp.id, fname from emp, dept where emp.dept_id = dept.id and dept.id in (1, 2) and emp.id not in (1, 5) @@ -208,12 +208,12 @@ join-tests: KEY:[0], ID: KEY:[2]]) | FILTER NOT _.ID IN promote(@c34 AS ARRAY(LONG)) | FETCH AS q2 RETURN (q2.ID AS ID, q2.FNAME AS FNAME) }' task_count: 6257 - task_total_time_ms: 1050 + task_total_time_ms: 1425 transform_count: 1873 - transform_time_ms: 279 + transform_time_ms: 432 transform_yield_count: 368 - insert_time_ms: 48 - insert_new_count: 1096 + insert_time_ms: 77 + insert_new_count: 1108 insert_reused_count: 65 - query: EXPLAIN select emp.id, fname from emp, dept where dept.id = emp.dept_id and dept.id in (1, 2) and emp.id not in (1, 5) @@ -223,12 +223,12 @@ join-tests: ID: KEY:[2]]) | FILTER NOT _.ID IN promote(@c34 AS ARRAY(LONG)) AND q1.ID EQUALS _.DEPT_ID | FETCH AS q2 RETURN (q2.ID AS ID, q2.FNAME AS FNAME) }' task_count: 5354 - task_total_time_ms: 769 + task_total_time_ms: 883 transform_count: 1622 - transform_time_ms: 216 + transform_time_ms: 259 transform_yield_count: 319 - insert_time_ms: 36 - insert_new_count: 882 + insert_time_ms: 81 + insert_new_count: 893 insert_reused_count: 60 - query: EXPLAIN select emp.id from emp, dept where emp.dept_id = dept.id and dept.id = 1 and emp.id in (10, 20, 30) @@ -237,12 +237,12 @@ join-tests: AS ARRAY(LONG)))] | INJOIN q1 -> { SCAN([IS EMP, EQUALS q1]) | FILTER _.DEPT_ID EQUALS q0.ID } AS q2 RETURN (q2.ID AS ID) } task_count: 6626 - task_total_time_ms: 1126 + task_total_time_ms: 1294 transform_count: 1914 - transform_time_ms: 280 + transform_time_ms: 374 transform_yield_count: 406 - insert_time_ms: 52 - insert_new_count: 1216 + insert_time_ms: 68 + insert_new_count: 1230 insert_reused_count: 60 - query: EXPLAIN select * from ja join jb using(c1) join jd using(c1); ref: join-tests.yamsql:422 @@ -559,12 +559,12 @@ three-way-joins-right-deep-planner: q2 -> { SCAN([IS PROJECT]) | FILTER _.EMP_ID EQUALS q2.ID AS q3 RETURN q3 } AS q3 RETURN (q1.ID AS ID, q1.NAME AS _1, q3.NAME AS _2) }' task_count: 8826 - task_total_time_ms: 719 + task_total_time_ms: 841 transform_count: 2647 - transform_time_ms: 206 + transform_time_ms: 245 transform_yield_count: 525 - insert_time_ms: 32 - insert_new_count: 1559 + insert_time_ms: 40 + insert_new_count: 1577 insert_reused_count: 110 - query: EXPLAIN select * from ja join jb using(c1) join jd using(c1); ref: join-tests.yamsql:627 diff --git a/yaml-tests/src/test/resources/join-with-order-by-tests.metrics.binpb b/yaml-tests/src/test/resources/join-with-order-by-tests.metrics.binpb index 3c6a16b5186..4e662a8e38c 100644 --- a/yaml-tests/src/test/resources/join-with-order-by-tests.metrics.binpb +++ b/yaml-tests/src/test/resources/join-with-order-by-tests.metrics.binpb @@ -1091,22 +1091,22 @@ j rankDir=LR; 3 -> 4 [ color="red" style="invis" ]; } -}Š' +}‹'  -joins-with-order-by-testsbEXPLAIN select (t1.*), (t3.*) from t1, t3 where t1.a1 IN (1, 2) and t3.aRef = t1.id order by t1.a2†& -–Œ²³•‘ ìܽx(ï0µÌí8·@-û[IN arrayDistinct(promote(@c21 AS ARRAY(LONG)))] INUNION q0 -> { COVERING(t1$a1_a2 [EQUALS q0] -> [a1: KEY:[0], a2: KEY:[1], id: KEY:[2]]) } COMPARE BY (_.a2, _.id, _.a1) | FETCH | FLATMAP q1 -> { ISCAN(t3$aRef [EQUALS q1.id]) AS q2 RETURN ((q1.id AS id, q1.a1 AS a1, q1.a2 AS a2, q1.a3 AS a3) AS t1, (q2.id AS id, q2.c1 AS c1, q2.c2 AS c2, q2.c3 AS c3, q2.aRef AS aRef) AS t3) }å"digraph G { +joins-with-order-by-testsbEXPLAIN select (t1.*), (t3.*) from t1, t3 where t1.a1 IN (1, 2) and t3.aRef = t1.id order by t1.a2‡& +–ú‡·È‘ «¸äå(ï0‡ö¼8Ë@-û[IN arrayDistinct(promote(@c21 AS ARRAY(LONG)))] INUNION q0 -> { COVERING(t1$a1_a2 [EQUALS q0] -> [a1: KEY:[0], a2: KEY:[1], id: KEY:[2]]) } COMPARE BY (_.a2, _.id, _.a1) | FETCH | FLATMAP q1 -> { ISCAN(t3$aRef [EQUALS q1.id]) AS q2 RETURN ((q1.id AS id, q1.a1 AS a1, q1.a2 AS a2, q1.a3 AS a3) AS t1, (q2.id AS id, q2.c1 AS c1, q2.c2 AS c2, q2.c3 AS c3, q2.aRef AS aRef) AS t3) }å"digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP ((q2.id AS id, q2.a1 AS a1, q2.a2 AS a2, q2.a3 AS a3) AS t1, (q6.id AS id, q6.c1 AS c1, q6.c2 AS c2, q6.c3 AS c3, q6.aRef AS aRef) AS t3)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3 AS t1, LONG AS id, LONG AS c1, LONG AS c2, STRING AS c3, LONG AS aRef AS t3)" ]; 2 [ label=<
Fetch Records
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; 3 [ label=<
In Union
COMPARE BY (_.a2, _.id, _.a1)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; - 4 [ label=<
Values
VALUES([__corr_q183 IN arrayDistinct(promote(@c21 AS ARRAY(LONG)))]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; - 5 [ label=<
Covering Index Scan
comparisons: [EQUALS q183]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; + 4 [ label=<
Values
VALUES([__corr_q189 IN arrayDistinct(promote(@c21 AS ARRAY(LONG)))]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; + 5 [ label=<
Covering Index Scan
comparisons: [EQUALS q189]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; 6 [ label=<
Index
t1$a1_a2
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; 7 [ label=<
Index Scan
comparisons: [EQUALS q2.id]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS c1, LONG AS c2, STRING AS c3, LONG AS aRef, VERSION AS __ROW_VERSION)" ]; 8 [ label=<
Index
t3$aRef
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS c1, LONG AS c2, STRING AS c3, LONG AS aRef, VERSION AS __ROW_VERSION)" ]; - 3 -> 2 [ label=< q203> label="q203" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 3 -> 2 [ label=< q211> label="q211" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 4 -> 3 [ color="black" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 3 [ color="black" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -1129,28 +1129,28 @@ j }¬" † joins-with-order-by-testsiEXPLAIN select (t1.*), (t3.*) from t1, t3 where t1.a1 IN (1, 2) and t3.aRef = t1.id order by t1.a1, t1.a2 ! -À!éÛê¹â - ¡ŒùÒ(¥0Î¼Ø 8ƒ@/¯[IN arrayDistinct(promote(@c21 AS ARRAY(LONG))) SORTED] | INJOIN q0 -> { ISCAN(t1$a1_a2 [EQUALS q0]) } | FLATMAP q1 -> { ISCAN(t3$aRef [EQUALS q1.id]) AS q2 RETURN ((q1.id AS id, q1.a1 AS a1, q1.a2 AS a2, q1.a3 AS a3) AS t1, (q2.id AS id, q2.c1 AS c1, q2.c2 AS c2, q2.c3 AS c3, q2.aRef AS aRef) AS t3) }Êdigraph G { +À!ä‚££â + ï³…•(¥0¦ÿ«8š@/¯[IN arrayDistinct(promote(@c21 AS ARRAY(LONG))) SORTED] | INJOIN q0 -> { ISCAN(t1$a1_a2 [EQUALS q0]) } | FLATMAP q1 -> { ISCAN(t3$aRef [EQUALS q1.id]) AS q2 RETURN ((q1.id AS id, q1.a1 AS a1, q1.a2 AS a2, q1.a3 AS a3) AS t1, (q2.id AS id, q2.c1 AS c1, q2.c2 AS c2, q2.c3 AS c3, q2.aRef AS aRef) AS t3) }Êdigraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP ((q2.id AS id, q2.a1 AS a1, q2.a2 AS a2, q2.a3 AS a3) AS t1, (q6.id AS id, q6.c1 AS c1, q6.c2 AS c2, q6.c3 AS c3, q6.aRef AS aRef) AS t3)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3 AS t1, LONG AS id, LONG AS c1, LONG AS c2, STRING AS c3, LONG AS aRef AS t3)" ]; 2 [ label=<
Nested Loop Join
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; - 3 [ label=<
Table Function
EXPLODE(arrayDistinct(promote(@c21 AS ARRAY(LONG))))
> color="black" shape="plain" style="filled" fillcolor="darkseagreen2" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; - 4 [ label=<
Index Scan
comparisons: [EQUALS q256]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; + 3 [ label=<
Index Scan
comparisons: [EQUALS q264]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; + 4 [ label=<
Table Function
EXPLODE(arrayDistinct(promote(@c21 AS ARRAY(LONG))))
> color="black" shape="plain" style="filled" fillcolor="darkseagreen2" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; 5 [ label=<
Index
t1$a1_a2
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; 6 [ label=<
Index Scan
comparisons: [EQUALS q2.id]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS c1, LONG AS c2, STRING AS c3, LONG AS aRef, VERSION AS __ROW_VERSION)" ]; 7 [ label=<
Index
t3$aRef
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS c1, LONG AS c2, STRING AS c3, LONG AS aRef, VERSION AS __ROW_VERSION)" ]; 3 -> 2 [ color="black" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 4 -> 2 [ color="black" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 7 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 1 [ label=< q6> label="q6" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; { rank=same; rankDir=LR; - 3 -> 4 [ color="red" style="invis" ]; + 4 -> 3 [ color="red" style="invis" ]; } { 6 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; @@ -1163,14 +1163,14 @@ j }ï" � joins-with-order-by-testsrEXPLAIN select (t1.*), (t3.*) from t1, t3 where t1.a1 IN (1, 2) and t3.aRef = t1.id order by t1.a1 asc, t1.a2 descÚ! -…Õê…€ß ”刓(á0ý«ž8î@+·[IN arrayDistinct(promote(@c21 AS ARRAY(LONG))) SORTED] | INJOIN q0 -> { ISCAN(t1$a1_a2 [EQUALS q0] REVERSE) } | FLATMAP q1 -> { ISCAN(t3$aRef [EQUALS q1.id]) AS q2 RETURN ((q1.id AS id, q1.a1 AS a1, q1.a2 AS a2, q1.a3 AS a3) AS t1, (q2.id AS id, q2.c1 AS c1, q2.c2 AS c2, q2.c3 AS c3, q2.aRef AS aRef) AS t3) }üdigraph G { +…г±Õß Íâþ�(á0ˆ¥¼8û@+·[IN arrayDistinct(promote(@c21 AS ARRAY(LONG))) SORTED] | INJOIN q0 -> { ISCAN(t1$a1_a2 [EQUALS q0] REVERSE) } | FLATMAP q1 -> { ISCAN(t3$aRef [EQUALS q1.id]) AS q2 RETURN ((q1.id AS id, q1.a1 AS a1, q1.a2 AS a2, q1.a3 AS a3) AS t1, (q2.id AS id, q2.c1 AS c1, q2.c2 AS c2, q2.c3 AS c3, q2.aRef AS aRef) AS t3) }üdigraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP ((q2.id AS id, q2.a1 AS a1, q2.a2 AS a2, q2.a3 AS a3) AS t1, (q6.id AS id, q6.c1 AS c1, q6.c2 AS c2, q6.c3 AS c3, q6.aRef AS aRef) AS t3)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3 AS t1, LONG AS id, LONG AS c1, LONG AS c2, STRING AS c3, LONG AS aRef AS t3)" ]; 2 [ label=<
Nested Loop Join
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; 3 [ label=<
Table Function
EXPLODE(arrayDistinct(promote(@c21 AS ARRAY(LONG))))
> color="black" shape="plain" style="filled" fillcolor="darkseagreen2" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; - 4 [ label=<
Index Scan
comparisons: [EQUALS q175]
direction: reversed
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; + 4 [ label=<
Index Scan
comparisons: [EQUALS q181]
direction: reversed
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; 5 [ label=<
Index
t1$a1_a2
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; 6 [ label=<
Index Scan
comparisons: [EQUALS q2.id]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS c1, LONG AS c2, STRING AS c3, LONG AS aRef, VERSION AS __ROW_VERSION)" ]; 7 [ label=<
Index
t3$aRef
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS c1, LONG AS c2, STRING AS c3, LONG AS aRef, VERSION AS __ROW_VERSION)" ]; @@ -1180,11 +1180,6 @@ j 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 7 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 1 [ label=< q6> label="q6" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - { - rank=same; - rankDir=LR; - 3 -> 4 [ color="red" style="invis" ]; - } { 6 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } @@ -1193,17 +1188,22 @@ j rankDir=LR; 2 -> 6 [ color="red" style="invis" ]; } + { + rank=same; + rankDir=LR; + 3 -> 4 [ color="red" style="invis" ]; + } }º" � joins-with-order-by-testsrEXPLAIN select (t1.*), (t3.*) from t1, t3 where t1.a1 IN (1, 2) and t3.aRef = t1.id order by t1.a1 desc, t1.a2 asc¥! -…”ìàþß ²åŠ�(á0Û—� 8î@+´[IN arrayDistinct(promote(@c21 AS ARRAY(LONG))) SORTED DESC] | INJOIN q0 -> { ISCAN(t1$a1_a2 [EQUALS q0]) } | FLATMAP q1 -> { ISCAN(t3$aRef [EQUALS q1.id]) AS q2 RETURN ((q1.id AS id, q1.a1 AS a1, q1.a2 AS a2, q1.a3 AS a3) AS t1, (q2.id AS id, q2.c1 AS c1, q2.c2 AS c2, q2.c3 AS c3, q2.aRef AS aRef) AS t3) }Êdigraph G { +…Ÿ„Óïß Ä®ŒÎ(á0°À¬8û@+´[IN arrayDistinct(promote(@c21 AS ARRAY(LONG))) SORTED DESC] | INJOIN q0 -> { ISCAN(t1$a1_a2 [EQUALS q0]) } | FLATMAP q1 -> { ISCAN(t3$aRef [EQUALS q1.id]) AS q2 RETURN ((q1.id AS id, q1.a1 AS a1, q1.a2 AS a2, q1.a3 AS a3) AS t1, (q2.id AS id, q2.c1 AS c1, q2.c2 AS c2, q2.c3 AS c3, q2.aRef AS aRef) AS t3) }Êdigraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP ((q2.id AS id, q2.a1 AS a1, q2.a2 AS a2, q2.a3 AS a3) AS t1, (q6.id AS id, q6.c1 AS c1, q6.c2 AS c2, q6.c3 AS c3, q6.aRef AS aRef) AS t3)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3 AS t1, LONG AS id, LONG AS c1, LONG AS c2, STRING AS c3, LONG AS aRef AS t3)" ]; 2 [ label=<
Nested Loop Join
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; 3 [ label=<
Table Function
EXPLODE(arrayDistinct(promote(@c21 AS ARRAY(LONG))))
> color="black" shape="plain" style="filled" fillcolor="darkseagreen2" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; - 4 [ label=<
Index Scan
comparisons: [EQUALS q175]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; + 4 [ label=<
Index Scan
comparisons: [EQUALS q181]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; 5 [ label=<
Index
t1$a1_a2
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; 6 [ label=<
Index Scan
comparisons: [EQUALS q2.id]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS c1, LONG AS c2, STRING AS c3, LONG AS aRef, VERSION AS __ROW_VERSION)" ]; 7 [ label=<
Index
t3$aRef
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS c1, LONG AS c2, STRING AS c3, LONG AS aRef, VERSION AS __ROW_VERSION)" ]; @@ -1213,23 +1213,23 @@ j 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 7 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 1 [ label=< q6> label="q6" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - { - 6 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; - } { rank=same; rankDir=LR; - 2 -> 6 [ color="red" style="invis" ]; + 3 -> 4 [ color="red" style="invis" ]; + } + { + 6 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { rank=same; rankDir=LR; - 3 -> 4 [ color="red" style="invis" ]; + 2 -> 6 [ color="red" style="invis" ]; } }÷? Ü joins-with-order-by-tests¾EXPLAIN select (t1.*) as a, (t3.*) as b from t1, t3 where t1.a1 IN (1, 2) and t3.c1 = t1.a1 and exists (select 4 from t2 where t2.b1 = t1.a1) and t3.c2 = t1.a2 order by t1.a1 asc, t1.a2 desc•> - ߽ίñ œŸî±(¹0éÔß8À@UÛ[IN arrayDistinct(promote(@c25 AS ARRAY(LONG))) SORTED] | INJOIN q0 -> { ISCAN(t1$a1_a2 [EQUALS q0] REVERSE) } | FLATMAP q1 -> { COVERING(t2$b1 [EQUALS q1.a1] -> [b1: KEY:[0], id: KEY:[1]]) | MAP (@c42 AS _0) | DEFAULT NULL | FILTER _ NOT_NULL AS q2 RETURN q1 } | FLATMAP q1 -> { ISCAN(t3$c1_c2 [EQUALS q1.a1, EQUALS q1.a2]) AS q4 RETURN ((q1.id AS id, q1.a1 AS a1, q1.a2 AS a2, q1.a3 AS a3) AS a, (q4.id AS id, q4.c1 AS c1, q4.c2 AS c2, q4.c3 AS c3, q4.aRef AS aRef) AS b) }“:digraph G { + ¹€Ê§ñ Êìˆì(¹0éî£%8Æ@UÛ[IN arrayDistinct(promote(@c25 AS ARRAY(LONG))) SORTED] | INJOIN q0 -> { ISCAN(t1$a1_a2 [EQUALS q0] REVERSE) } | FLATMAP q1 -> { COVERING(t2$b1 [EQUALS q1.a1] -> [b1: KEY:[0], id: KEY:[1]]) | MAP (@c42 AS _0) | DEFAULT NULL | FILTER _ NOT_NULL AS q2 RETURN q1 } | FLATMAP q1 -> { ISCAN(t3$c1_c2 [EQUALS q1.a1, EQUALS q1.a2]) AS q4 RETURN ((q1.id AS id, q1.a1 AS a1, q1.a2 AS a2, q1.a3 AS a3) AS a, (q4.id AS id, q4.c1 AS c1, q4.c2 AS c2, q4.c3 AS c3, q4.aRef AS aRef) AS b) }“:digraph G { fontname=courier; rankdir=BT; splines=line; @@ -1237,8 +1237,8 @@ j 2 [ label=<
Nested Loop Join
FLATMAP q2
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; 3 [ label=<
Nested Loop Join
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; 4 [ label=<
Predicate Filter
WHERE q14 NOT_NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _0)" ]; - 5 [ label=<
Table Function
EXPLODE(arrayDistinct(promote(@c25 AS ARRAY(LONG))))
> color="black" shape="plain" style="filled" fillcolor="darkseagreen2" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; - 6 [ label=<
Index Scan
comparisons: [EQUALS q297]
direction: reversed
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; + 5 [ label=<
Index Scan
comparisons: [EQUALS q303]
direction: reversed
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; + 6 [ label=<
Table Function
EXPLODE(arrayDistinct(promote(@c25 AS ARRAY(LONG))))
> color="black" shape="plain" style="filled" fillcolor="darkseagreen2" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; 7 [ label=<
Value Computation
FIRST $q14 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _0)" ]; 8 [ label=<
Index
t1$a1_a2
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS id, LONG AS a1, LONG AS a2, STRING AS a3, VERSION AS __ROW_VERSION)" ]; 9 [ label=<
Value Computation
MAP (@c42 AS _0)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _0)" ]; @@ -1251,7 +1251,7 @@ j 5 -> 3 [ color="black" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 3 [ color="black" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 7 -> 4 [ label=< q14> label="q14" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 8 -> 6 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 5 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 9 -> 7 [ label=< q14> label="q14" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 10 -> 9 [ label=< q158> label="q158" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 11 -> 10 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -1259,34 +1259,34 @@ j 13 -> 12 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 12 -> 1 [ label=< q6> label="q6" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; { - 10 -> 2 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 10 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { - 4 -> 2 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 2 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { - rank=same; - rankDir=LR; - 3 -> 4 [ color="red" style="invis" ]; + 12 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { rank=same; rankDir=LR; - 5 -> 6 [ color="red" style="invis" ]; + 2 -> 12 [ color="red" style="invis" ]; } { - 12 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + rank=same; + rankDir=LR; + 6 -> 5 [ color="red" style="invis" ]; } { - 10 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 10 -> 2 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { - 2 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 4 -> 2 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { rank=same; rankDir=LR; - 2 -> 12 [ color="red" style="invis" ]; + 3 -> 4 [ color="red" style="invis" ]; } }� j diff --git a/yaml-tests/src/test/resources/join-with-order-by-tests.metrics.yaml b/yaml-tests/src/test/resources/join-with-order-by-tests.metrics.yaml index fc07fec55fd..1af0ce16dfa 100644 --- a/yaml-tests/src/test/resources/join-with-order-by-tests.metrics.yaml +++ b/yaml-tests/src/test/resources/join-with-order-by-tests.metrics.yaml @@ -573,12 +573,12 @@ joins-with-order-by-tests: RETURN ((q1.id AS id, q1.a1 AS a1, q1.a2 AS a2, q1.a3 AS a3) AS t1, (q2.id AS id, q2.c1 AS c1, q2.c2 AS c2, q2.c3 AS c3, q2.aRef AS aRef) AS t3) }' task_count: 3222 - task_total_time_ms: 581 + task_total_time_ms: 957 transform_count: 1169 - transform_time_ms: 252 + transform_time_ms: 481 transform_yield_count: 239 - insert_time_ms: 16 - insert_new_count: 439 + insert_time_ms: 40 + insert_new_count: 459 insert_reused_count: 45 - query: EXPLAIN select (t1.*), (t3.*) from t1, t3 where t1.a1 IN (1, 2) and t3.aRef = t1.id order by t1.a1, t1.a2 @@ -589,12 +589,12 @@ joins-with-order-by-tests: AS t1, (q2.id AS id, q2.c1 AS c1, q2.c2 AS c2, q2.c3 AS c3, q2.aRef AS aRef) AS t3) }' task_count: 4288 - task_total_time_ms: 926 + task_total_time_ms: 1147 transform_count: 1378 - transform_time_ms: 442 + transform_time_ms: 580 transform_yield_count: 293 - insert_time_ms: 20 - insert_new_count: 643 + insert_time_ms: 42 + insert_new_count: 666 insert_reused_count: 47 - query: EXPLAIN select (t1.*), (t3.*) from t1, t3 where t1.a1 IN (1, 2) and t3.aRef = t1.id order by t1.a1 asc, t1.a2 desc @@ -605,12 +605,12 @@ joins-with-order-by-tests: AS a3) AS t1, (q2.id AS id, q2.c1 AS c1, q2.c2 AS c2, q2.c3 AS c3, q2.aRef AS aRef) AS t3) }' task_count: 2949 - task_total_time_ms: 536 + task_total_time_ms: 984 transform_count: 1119 - transform_time_ms: 308 + transform_time_ms: 572 transform_yield_count: 225 - insert_time_ms: 15 - insert_new_count: 366 + insert_time_ms: 49 + insert_new_count: 379 insert_reused_count: 43 - query: EXPLAIN select (t1.*), (t3.*) from t1, t3 where t1.a1 IN (1, 2) and t3.aRef = t1.id order by t1.a1 desc, t1.a2 asc @@ -621,12 +621,12 @@ joins-with-order-by-tests: AS t1, (q2.id AS id, q2.c1 AS c1, q2.c2 AS c2, q2.c3 AS c3, q2.aRef AS aRef) AS t3) }' task_count: 2949 - task_total_time_ms: 534 + task_total_time_ms: 771 transform_count: 1119 - transform_time_ms: 302 + transform_time_ms: 432 transform_yield_count: 225 - insert_time_ms: 19 - insert_new_count: 366 + insert_time_ms: 38 + insert_new_count: 379 insert_reused_count: 43 - query: EXPLAIN select (t1.*) as a, (t3.*) as b from t1, t3 where t1.a1 IN (1, 2) and t3.c1 = t1.a1 and exists (select 4 from t2 where t2.b1 = t1.a1) and @@ -640,12 +640,12 @@ joins-with-order-by-tests: AS a2, q1.a3 AS a3) AS a, (q4.id AS id, q4.c1 AS c1, q4.c2 AS c2, q4.c3 AS c3, q4.aRef AS aRef) AS b) }' task_count: 4162 - task_total_time_ms: 905 + task_total_time_ms: 1156 transform_count: 1777 - transform_time_ms: 373 + transform_time_ms: 495 transform_yield_count: 313 - insert_time_ms: 49 - insert_new_count: 576 + insert_time_ms: 78 + insert_new_count: 582 insert_reused_count: 85 - query: EXPLAIN select (a.*), (b.*) from t1_f(1) as a, t2_f(1) as b where a.a3 = b.b3 diff --git a/yaml-tests/src/test/resources/right-deep-plan-tests.metrics.binpb b/yaml-tests/src/test/resources/right-deep-plan-tests.metrics.binpb index 3d5352fc5e6..516f39cdc20 100644 --- a/yaml-tests/src/test/resources/right-deep-plan-tests.metrics.binpb +++ b/yaml-tests/src/test/resources/right-deep-plan-tests.metrics.binpb @@ -1,23 +1,23 @@ -à- +ó- ‹ -array-join-default-plannermEXPLAIN SELECT t1.name, t2.name FROM t1, t1.t2_refs AS ref JOIN t2 ON ref = t2.id WHERE t2.id IN (1000, 2000)Ï, -õœò�dÍ …³š(º0;ò8‘@9ù[IN arrayDistinct(promote(@c29 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS T2, EQUALS q0]) } | FLATMAP q1 -> { SCAN([IS T1]) | FLATMAP q2 -> { EXPLODE q2.T2_REFS | FILTER _ EQUALS q1.ID AS q3 RETURN q2 } AS q2 RETURN (q2.NAME AS _0, q1.NAME AS _1) }±*digraph G { +array-join-default-plannermEXPLAIN SELECT t1.name, t2.name FROM t1, t1.t2_refs AS ref JOIN t2 ON ref = t2.id WHERE t2.id IN (1000, 2000)â, +ᇩ€‡È çÂß(¸0¡ˆ³ 8“@9ü[IN arrayDistinct(promote(@c29 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS T2, EQUALS q0]) } | FLATMAP q1 -> { SCAN([IS T1]) | FLATMAP q2 -> { EXPLODE q2.T2_REFS | FILTER _._0 EQUALS q1.ID AS q3 RETURN q2 } AS q2 RETURN (q2.NAME AS _0, q1.NAME AS _1) }À*digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.NAME AS _0, q8.NAME AS _1)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS _0, STRING AS _1)" ]; 2 [ label=<
Nested Loop Join
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; - 3 [ label=<
Table Function
EXPLODE(arrayDistinct(promote(@c29 AS ARRAY(LONG))))
> color="black" shape="plain" style="filled" fillcolor="darkseagreen2" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; - 4 [ label=<
Scan
comparisons: [IS T2, EQUALS q57]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; + 3 [ label=<
Scan
comparisons: [IS T2, EQUALS q54]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; + 4 [ label=<
Table Function
EXPLODE(arrayDistinct(promote(@c29 AS ARRAY(LONG))))
> color="black" shape="plain" style="filled" fillcolor="darkseagreen2" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; 5 [ label=<
Primary Storage
record types: [T1, T2]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; 6 [ label=<
Nested Loop Join
FLATMAP q2
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, ARRAY(LONG) AS T2_REFS)" ]; 7 [ label=<
Scan
comparisons: [IS T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, ARRAY(LONG) AS T2_REFS)" ]; - 8 [ label=<
Predicate Filter
WHERE q4 EQUALS q8.ID
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; + 8 [ label=<
Predicate Filter
WHERE q4._0 EQUALS q8.ID
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; 9 [ label=<
Primary Storage
record types: [T1, T2]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, ARRAY(LONG) AS T2_REFS)" ]; - 10 [ label=<
Value Computation
EXPLODE q2.T2_REFS
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; + 10 [ label=<
Value Computation
EXPLODE q2.T2_REFS
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; 3 -> 2 [ color="black" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 4 -> 2 [ color="black" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q8> label="q8" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 7 -> 6 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 8 -> 6 [ label=< q4> label="q4" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -25,77 +25,82 @@ 10 -> 8 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; { - 10 -> 6 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 10 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { - 8 -> 6 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 8 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { - rank=same; - rankDir=LR; - 7 -> 8 [ color="red" style="invis" ]; + 6 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { rank=same; rankDir=LR; - 3 -> 4 [ color="red" style="invis" ]; + 2 -> 6 [ color="red" style="invis" ]; } { - 10 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 10 -> 6 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { - 8 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 8 -> 6 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { - 6 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + rank=same; + rankDir=LR; + 7 -> 8 [ color="red" style="invis" ]; } { rank=same; rankDir=LR; - 2 -> 6 [ color="red" style="invis" ]; + 4 -> 3 [ color="red" style="invis" ]; } -}à- +}ô- Ž -array-join-right-deep-plannermEXPLAIN SELECT t1.name, t2.name FROM t1, t1.t2_refs AS ref JOIN t2 ON ref = t2.id WHERE t2.id IN (1000, 2000)Ì, -¸޼º6û ù‡å (l0æ‚ó8â@ù[IN arrayDistinct(promote(@c29 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS T2, EQUALS q0]) } | FLATMAP q1 -> { SCAN([IS T1]) | FLATMAP q2 -> { EXPLODE q2.T2_REFS | FILTER _ EQUALS q1.ID AS q3 RETURN q2 } AS q2 RETURN (q2.NAME AS _0, q1.NAME AS _1) }¯*digraph G { +array-join-right-deep-plannermEXPLAIN SELECT t1.name, t2.name FROM t1, t1.t2_refs AS ref JOIN t2 ON ref = t2.id WHERE t2.id IN (1000, 2000)à, +¤¥„úPö ܪþ(j0žÖå8á@ü[IN arrayDistinct(promote(@c29 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS T2, EQUALS q0]) } | FLATMAP q1 -> { SCAN([IS T1]) | FLATMAP q2 -> { EXPLODE q2.T2_REFS | FILTER _._0 EQUALS q1.ID AS q3 RETURN q2 } AS q2 RETURN (q2.NAME AS _0, q1.NAME AS _1) }À*digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.NAME AS _0, q8.NAME AS _1)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS _0, STRING AS _1)" ]; 2 [ label=<
Nested Loop Join
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; 3 [ label=<
Table Function
EXPLODE(arrayDistinct(promote(@c29 AS ARRAY(LONG))))
> color="black" shape="plain" style="filled" fillcolor="darkseagreen2" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; - 4 [ label=<
Scan
comparisons: [IS T2, EQUALS q55]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; + 4 [ label=<
Scan
comparisons: [IS T2, EQUALS q52]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; 5 [ label=<
Primary Storage
record types: [T1, T2]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; 6 [ label=<
Nested Loop Join
FLATMAP q2
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, ARRAY(LONG) AS T2_REFS)" ]; - 7 [ label=<
Predicate Filter
WHERE q4 EQUALS q8.ID
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; - 8 [ label=<
Scan
comparisons: [IS T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, ARRAY(LONG) AS T2_REFS)" ]; - 9 [ label=<
Value Computation
EXPLODE q2.T2_REFS
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; - 10 [ label=<
Primary Storage
record types: [T1, T2]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, ARRAY(LONG) AS T2_REFS)" ]; + 7 [ label=<
Scan
comparisons: [IS T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, ARRAY(LONG) AS T2_REFS)" ]; + 8 [ label=<
Predicate Filter
WHERE q4._0 EQUALS q8.ID
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 9 [ label=<
Primary Storage
record types: [T1, T2]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, ARRAY(LONG) AS T2_REFS)" ]; + 10 [ label=<
Value Computation
EXPLODE q2.T2_REFS
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; 3 -> 2 [ color="black" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 4 -> 2 [ color="black" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q8> label="q8" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 7 -> 6 [ label=< q4> label="q4" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 8 -> 6 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 9 -> 7 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 10 -> 8 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 6 [ label=< q4> label="q4" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 8 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; { - 9 -> 6 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + rank=same; + rankDir=LR; + 3 -> 4 [ color="red" style="invis" ]; + } + { + 10 -> 6 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { - 7 -> 6 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 8 -> 6 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { rank=same; rankDir=LR; - 8 -> 7 [ color="red" style="invis" ]; + 7 -> 8 [ color="red" style="invis" ]; } { - 9 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 10 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { - 7 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 8 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { 6 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; @@ -105,58 +110,48 @@ rankDir=LR; 2 -> 6 [ color="red" style="invis" ]; } - { - rank=same; - rankDir=LR; - 3 -> 4 [ color="red" style="invis" ]; - } -}€. +}”. ® -"array-join-right-deep-query-option‡EXPLAIN SELECT t1.name, t2.name FROM t1, t1.t2_refs AS ref JOIN t2 ON ref = t2.id WHERE t2.id IN (1000, 2000) OPTIONS (PLAN RIGHT DEEP)Ì, -¸޼º6û ù‡å (l0æ‚ó8â@ù[IN arrayDistinct(promote(@c29 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS T2, EQUALS q0]) } | FLATMAP q1 -> { SCAN([IS T1]) | FLATMAP q2 -> { EXPLODE q2.T2_REFS | FILTER _ EQUALS q1.ID AS q3 RETURN q2 } AS q2 RETURN (q2.NAME AS _0, q1.NAME AS _1) }¯*digraph G { +"array-join-right-deep-query-option‡EXPLAIN SELECT t1.name, t2.name FROM t1, t1.t2_refs AS ref JOIN t2 ON ref = t2.id WHERE t2.id IN (1000, 2000) OPTIONS (PLAN RIGHT DEEP)à, +¤¥„úPö ܪþ(j0žÖå8á@ü[IN arrayDistinct(promote(@c29 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS T2, EQUALS q0]) } | FLATMAP q1 -> { SCAN([IS T1]) | FLATMAP q2 -> { EXPLODE q2.T2_REFS | FILTER _._0 EQUALS q1.ID AS q3 RETURN q2 } AS q2 RETURN (q2.NAME AS _0, q1.NAME AS _1) }À*digraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.NAME AS _0, q8.NAME AS _1)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(STRING AS _0, STRING AS _1)" ]; 2 [ label=<
Nested Loop Join
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="12" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; - 3 [ label=<
Table Function
EXPLODE(arrayDistinct(promote(@c29 AS ARRAY(LONG))))
> color="black" shape="plain" style="filled" fillcolor="darkseagreen2" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; - 4 [ label=<
Scan
comparisons: [IS T2, EQUALS q55]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; + 3 [ label=<
Scan
comparisons: [IS T2, EQUALS q52]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; + 4 [ label=<
Table Function
EXPLODE(arrayDistinct(promote(@c29 AS ARRAY(LONG))))
> color="black" shape="plain" style="filled" fillcolor="darkseagreen2" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; 5 [ label=<
Primary Storage
record types: [T1, T2]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME)" ]; 6 [ label=<
Nested Loop Join
FLATMAP q2
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, ARRAY(LONG) AS T2_REFS)" ]; - 7 [ label=<
Predicate Filter
WHERE q4 EQUALS q8.ID
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; - 8 [ label=<
Scan
comparisons: [IS T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, ARRAY(LONG) AS T2_REFS)" ]; - 9 [ label=<
Value Computation
EXPLODE q2.T2_REFS
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; - 10 [ label=<
Primary Storage
record types: [T1, T2]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, ARRAY(LONG) AS T2_REFS)" ]; + 7 [ label=<
Scan
comparisons: [IS T1]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, ARRAY(LONG) AS T2_REFS)" ]; + 8 [ label=<
Predicate Filter
WHERE q4._0 EQUALS q8.ID
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 9 [ label=<
Primary Storage
record types: [T1, T2]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS NAME, ARRAY(LONG) AS T2_REFS)" ]; + 10 [ label=<
Value Computation
EXPLODE q2.T2_REFS
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; 3 -> 2 [ color="black" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 4 -> 2 [ color="black" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 5 -> 4 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q8> label="q8" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 7 -> 6 [ label=< q4> label="q4" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 8 -> 6 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 9 -> 7 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 10 -> 8 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 6 [ label=< q4> label="q4" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 7 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 10 -> 8 [ label=< q4> label="q4" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 6 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; { - 9 -> 6 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; - } - { - 7 -> 6 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 10 -> 6 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { - rank=same; - rankDir=LR; - 8 -> 7 [ color="red" style="invis" ]; + 8 -> 6 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { rank=same; rankDir=LR; - 3 -> 4 [ color="red" style="invis" ]; + 7 -> 8 [ color="red" style="invis" ]; } { - 9 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 10 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { - 7 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + 8 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; } { 6 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; @@ -166,4 +161,9 @@ rankDir=LR; 2 -> 6 [ color="red" style="invis" ]; } + { + rank=same; + rankDir=LR; + 4 -> 3 [ color="red" style="invis" ]; + } } \ No newline at end of file diff --git a/yaml-tests/src/test/resources/right-deep-plan-tests.metrics.yaml b/yaml-tests/src/test/resources/right-deep-plan-tests.metrics.yaml index f96c23e24aa..c5f2864fd5f 100644 --- a/yaml-tests/src/test/resources/right-deep-plan-tests.metrics.yaml +++ b/yaml-tests/src/test/resources/right-deep-plan-tests.metrics.yaml @@ -4,15 +4,15 @@ array-join-default-planner: ref: right-deep-plan-tests.yamsql:37 explain: '[IN arrayDistinct(promote(@c29 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS T2, EQUALS q0]) } | FLATMAP q1 -> { SCAN([IS T1]) | FLATMAP q2 -> { EXPLODE - q2.T2_REFS | FILTER _ EQUALS q1.ID AS q3 RETURN q2 } AS q2 RETURN (q2.NAME + q2.T2_REFS | FILTER _._0 EQUALS q1.ID AS q3 RETURN q2 } AS q2 RETURN (q2.NAME AS _0, q1.NAME AS _1) }' - task_count: 3317 - task_total_time_ms: 209 - transform_count: 1485 - transform_time_ms: 42 - transform_yield_count: 186 - insert_time_ms: 14 - insert_new_count: 401 + task_count: 3297 + task_total_time_ms: 283 + transform_count: 1480 + transform_time_ms: 62 + transform_yield_count: 184 + insert_time_ms: 19 + insert_new_count: 403 insert_reused_count: 57 array-join-right-deep-planner: - query: EXPLAIN SELECT t1.name, t2.name FROM t1, t1.t2_refs AS ref JOIN t2 ON ref @@ -20,15 +20,15 @@ array-join-right-deep-planner: ref: right-deep-plan-tests.yamsql:56 explain: '[IN arrayDistinct(promote(@c29 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS T2, EQUALS q0]) } | FLATMAP q1 -> { SCAN([IS T1]) | FLATMAP q2 -> { EXPLODE - q2.T2_REFS | FILTER _ EQUALS q1.ID AS q3 RETURN q2 } AS q2 RETURN (q2.NAME + q2.T2_REFS | FILTER _._0 EQUALS q1.ID AS q3 RETURN q2 } AS q2 RETURN (q2.NAME AS _0, q1.NAME AS _1) }' - task_count: 1848 - task_total_time_ms: 114 - transform_count: 763 - transform_time_ms: 26 - transform_yield_count: 108 - insert_time_ms: 3 - insert_new_count: 226 + task_count: 1828 + task_total_time_ms: 169 + transform_count: 758 + transform_time_ms: 41 + transform_yield_count: 106 + insert_time_ms: 5 + insert_new_count: 225 insert_reused_count: 26 array-join-right-deep-query-option: - query: EXPLAIN SELECT t1.name, t2.name FROM t1, t1.t2_refs AS ref JOIN t2 ON ref @@ -36,13 +36,13 @@ array-join-right-deep-query-option: ref: right-deep-plan-tests.yamsql:76 explain: '[IN arrayDistinct(promote(@c29 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS T2, EQUALS q0]) } | FLATMAP q1 -> { SCAN([IS T1]) | FLATMAP q2 -> { EXPLODE - q2.T2_REFS | FILTER _ EQUALS q1.ID AS q3 RETURN q2 } AS q2 RETURN (q2.NAME + q2.T2_REFS | FILTER _._0 EQUALS q1.ID AS q3 RETURN q2 } AS q2 RETURN (q2.NAME AS _0, q1.NAME AS _1) }' - task_count: 1848 - task_total_time_ms: 114 - transform_count: 763 - transform_time_ms: 26 - transform_yield_count: 108 - insert_time_ms: 3 - insert_new_count: 226 + task_count: 1828 + task_total_time_ms: 169 + transform_count: 758 + transform_time_ms: 41 + transform_yield_count: 106 + insert_time_ms: 5 + insert_new_count: 225 insert_reused_count: 26 diff --git a/yaml-tests/src/test/resources/right-deep-plan-tests.yamsql b/yaml-tests/src/test/resources/right-deep-plan-tests.yamsql index 4f63cd31500..ac7c46783b8 100644 --- a/yaml-tests/src/test/resources/right-deep-plan-tests.yamsql +++ b/yaml-tests/src/test/resources/right-deep-plan-tests.yamsql @@ -34,7 +34,7 @@ test_block: FROM t1, t1.t2_refs AS ref JOIN t2 ON ref = t2.id WHERE t2.id IN (1000, 2000) - - explain: "[IN arrayDistinct(promote(@c29 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS T2, EQUALS q0]) } | FLATMAP q1 -> { SCAN([IS T1]) | FLATMAP q2 -> { EXPLODE q2.T2_REFS | FILTER _ EQUALS q1.ID AS q3 RETURN q2 } AS q2 RETURN (q2.NAME AS _0, q1.NAME AS _1) }" + - explain: "[IN arrayDistinct(promote(@c29 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS T2, EQUALS q0]) } | FLATMAP q1 -> { SCAN([IS T1]) | FLATMAP q2 -> { EXPLODE q2.T2_REFS | FILTER _._0 EQUALS q1.ID AS q3 RETURN q2 } AS q2 RETURN (q2.NAME AS _0, q1.NAME AS _1) }" - unorderedResult: [ {'A1', 'B1'}, {'A1', 'B2'}, @@ -53,7 +53,7 @@ test_block: FROM t1, t1.t2_refs AS ref JOIN t2 ON ref = t2.id WHERE t2.id IN (1000, 2000) - - explain: "[IN arrayDistinct(promote(@c29 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS T2, EQUALS q0]) } | FLATMAP q1 -> { SCAN([IS T1]) | FLATMAP q2 -> { EXPLODE q2.T2_REFS | FILTER _ EQUALS q1.ID AS q3 RETURN q2 } AS q2 RETURN (q2.NAME AS _0, q1.NAME AS _1) }" + - explain: "[IN arrayDistinct(promote(@c29 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS T2, EQUALS q0]) } | FLATMAP q1 -> { SCAN([IS T1]) | FLATMAP q2 -> { EXPLODE q2.T2_REFS | FILTER _._0 EQUALS q1.ID AS q3 RETURN q2 } AS q2 RETURN (q2.NAME AS _0, q1.NAME AS _1) }" - unorderedResult: [ {'A1', 'B1'}, {'A1', 'B2'}, @@ -73,7 +73,7 @@ test_block: JOIN t2 ON ref = t2.id WHERE t2.id IN (1000, 2000) OPTIONS (PLAN RIGHT DEEP) - - explain: "[IN arrayDistinct(promote(@c29 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS T2, EQUALS q0]) } | FLATMAP q1 -> { SCAN([IS T1]) | FLATMAP q2 -> { EXPLODE q2.T2_REFS | FILTER _ EQUALS q1.ID AS q3 RETURN q2 } AS q2 RETURN (q2.NAME AS _0, q1.NAME AS _1) }" + - explain: "[IN arrayDistinct(promote(@c29 AS ARRAY(LONG)))] | INJOIN q0 -> { SCAN([IS T2, EQUALS q0]) } | FLATMAP q1 -> { SCAN([IS T1]) | FLATMAP q2 -> { EXPLODE q2.T2_REFS | FILTER _._0 EQUALS q1.ID AS q3 RETURN q2 } AS q2 RETURN (q2.NAME AS _0, q1.NAME AS _1) }" - unorderedResult: [ {'A1', 'B1'}, {'A1', 'B2'}, diff --git a/yaml-tests/src/test/resources/subquery-tests.metrics.binpb b/yaml-tests/src/test/resources/subquery-tests.metrics.binpb index d4e8c511e6d..f5a7a64b2bf 100644 Binary files a/yaml-tests/src/test/resources/subquery-tests.metrics.binpb and b/yaml-tests/src/test/resources/subquery-tests.metrics.binpb differ diff --git a/yaml-tests/src/test/resources/subquery-tests.metrics.yaml b/yaml-tests/src/test/resources/subquery-tests.metrics.yaml index f72fb233c60..6b721feadac 100644 --- a/yaml-tests/src/test/resources/subquery-tests.metrics.yaml +++ b/yaml-tests/src/test/resources/subquery-tests.metrics.yaml @@ -1,7 +1,7 @@ subquery-from: - query: EXPLAIN SELECT id FROM T3, T3.nr AS nest WHERE nest.f = 23; ref: subquery-tests.yamsql:77 - explain: ISCAN(T3_id_i <,>) | FLATMAP q0 -> { EXPLODE q0.nr | FILTER _.f EQUALS + explain: ISCAN(T3_id_i <,>) | FLATMAP q0 -> { EXPLODE q0.nr | FILTER _._0.f EQUALS promote(@c15 AS INT) AS q1 RETURN (q0.id AS id) } task_count: 293 task_total_time_ms: 132 @@ -14,7 +14,7 @@ subquery-from: - query: EXPLAIN SELECT id FROM T3, (SELECT * FROM T3.nr) AS nest WHERE nest.f = 23; ref: subquery-tests.yamsql:82 - explain: ISCAN(T3_id_i <,>) | FLATMAP q0 -> { EXPLODE q0.nr | FILTER _.f EQUALS + explain: ISCAN(T3_id_i <,>) | FLATMAP q0 -> { EXPLODE q0.nr | FILTER _._0.f EQUALS promote(@c20 AS INT) AS q1 RETURN (q0.id AS id) } task_count: 328 task_total_time_ms: 132 @@ -41,8 +41,8 @@ subquery-from: f FROM sq.nr WHERE f > 10) sq2 WHERE sq.i = 10 AND sq2.f IS NOT NULL ref: subquery-tests.yamsql:97 explain: ISCAN(T3_id_i [EQUALS promote(@c17 AS INT), EQUALS promote(@c31 AS INT)]) - | FLATMAP q0 -> { EXPLODE q0.nr | FILTER _.f GREATER_THAN promote(@c31 AS - INT) AND _.f NOT_NULL AS q1 RETURN (q0.id AS id, q0.i AS i) } + | FLATMAP q0 -> { EXPLODE q0.nr | FILTER _._0.f GREATER_THAN promote(@c31 + AS INT) AND _._0.f NOT_NULL AS q1 RETURN (q0.id AS id, q0.i AS i) } task_count: 584 task_total_time_ms: 162 transform_count: 159 @@ -146,14 +146,14 @@ exists-subquery: ref: subquery-tests.yamsql:227 explain: SCAN([IS T1]) | FILTER _.T2 EQUALS promote(@c5 AS INT) | MAP (_.id AS id) | DEFAULT NULL | FLATMAP q0 -> { EXPLODE array((@c5 AS a, exists(q0) AS - e)) AS q1 RETURN q1 } - task_count: 304 - task_total_time_ms: 17 - transform_count: 91 - transform_time_ms: 5 - transform_yield_count: 21 + e)) AS q1 RETURN (q1._0.a AS a, q1._0.e AS e) } + task_count: 329 + task_total_time_ms: 36 + transform_count: 96 + transform_time_ms: 10 + transform_yield_count: 23 insert_time_ms: 1 - insert_new_count: 31 + insert_new_count: 36 insert_reused_count: 2 - query: EXPLAIN SELECT p.id, c.id AS cid FROM T5 p JOIN T6 c ON c.i1 = p.id AND EXISTS (SELECT id FROM T1 WHERE T1.id = c.id) diff --git a/yaml-tests/src/test/resources/subquery-tests.yamsql b/yaml-tests/src/test/resources/subquery-tests.yamsql index c3171a9805d..d5d9f1d3f0c 100644 --- a/yaml-tests/src/test/resources/subquery-tests.yamsql +++ b/yaml-tests/src/test/resources/subquery-tests.yamsql @@ -74,12 +74,12 @@ test_block: - # PartiQL-style unnesting of an ARRAY column in the FROM clause. - query: SELECT id FROM T3, T3.nr AS nest WHERE nest.f = 23; - - explain: "ISCAN(T3_id_i <,>) | FLATMAP q0 -> { EXPLODE q0.nr | FILTER _.f EQUALS promote(@c15 AS INT) AS q1 RETURN (q0.id AS id) }" + - explain: "ISCAN(T3_id_i <,>) | FLATMAP q0 -> { EXPLODE q0.nr | FILTER _._0.f EQUALS promote(@c15 AS INT) AS q1 RETURN (q0.id AS id) }" - result: [{2}] - # The same unnesting, expressed as a FROM-clause subquery. The plan is the same as for the direct unnesting above. - query: SELECT id FROM T3, (SELECT * FROM T3.nr) AS nest WHERE nest.f = 23; - - explain: "ISCAN(T3_id_i <,>) | FLATMAP q0 -> { EXPLODE q0.nr | FILTER _.f EQUALS promote(@c20 AS INT) AS q1 RETURN (q0.id AS id) }" + - explain: "ISCAN(T3_id_i <,>) | FLATMAP q0 -> { EXPLODE q0.nr | FILTER _._0.f EQUALS promote(@c20 AS INT) AS q1 RETURN (q0.id AS id) }" - result: [{2}] - # FROM-clause subquery correlated to a preceding table source (`T1.T2`). @@ -94,7 +94,7 @@ test_block: (SELECT f FROM sq.nr WHERE f > 10) sq2 WHERE sq.i = 10 AND sq2.f IS NOT NULL - - explain: "ISCAN(T3_id_i [EQUALS promote(@c17 AS INT), EQUALS promote(@c31 AS INT)]) | FLATMAP q0 -> { EXPLODE q0.nr | FILTER _.f GREATER_THAN promote(@c31 AS INT) AND _.f NOT_NULL AS q1 RETURN (q0.id AS id, q0.i AS i) }" + - explain: "ISCAN(T3_id_i [EQUALS promote(@c17 AS INT), EQUALS promote(@c31 AS INT)]) | FLATMAP q0 -> { EXPLODE q0.nr | FILTER _._0.f GREATER_THAN promote(@c31 AS INT) AND _._0.f NOT_NULL AS q1 RETURN (q0.id AS id, q0.i AS i) }" - result: [{1, 10}, {1, 10}, {1, 10}] - # FROM-clause subquery containing a grouped query. @@ -224,7 +224,7 @@ test_block: - # EXISTS subquery in a row of an inline VALUES table in the FROM clause. - query: SELECT * FROM VALUES (1, EXISTS (SELECT id FROM T1 WHERE T1.T2 = 1)) AS t (a, e) - - explain: "SCAN([IS T1]) | FILTER _.T2 EQUALS promote(@c5 AS INT) | MAP (_.id AS id) | DEFAULT NULL | FLATMAP q0 -> { EXPLODE array((@c5 AS a, exists(q0) AS e)) AS q1 RETURN q1 }" + - explain: "SCAN([IS T1]) | FILTER _.T2 EQUALS promote(@c5 AS INT) | MAP (_.id AS id) | DEFAULT NULL | FLATMAP q0 -> { EXPLODE array((@c5 AS a, exists(q0) AS e)) AS q1 RETURN (q1._0.a AS a, q1._0.e AS e) }" - result: [{a: 1, e: true}] - # Correlated EXISTS subquery in the ON clause of an INNER JOIN. diff --git a/yaml-tests/src/test/resources/table-functions.metrics.binpb b/yaml-tests/src/test/resources/table-functions.metrics.binpb index 7476598bf36..6e42f53f345 100644 Binary files a/yaml-tests/src/test/resources/table-functions.metrics.binpb and b/yaml-tests/src/test/resources/table-functions.metrics.binpb differ diff --git a/yaml-tests/src/test/resources/table-functions.metrics.yaml b/yaml-tests/src/test/resources/table-functions.metrics.yaml index 1124a09d261..ccbbaf73145 100644 --- a/yaml-tests/src/test/resources/table-functions.metrics.yaml +++ b/yaml-tests/src/test/resources/table-functions.metrics.yaml @@ -4,70 +4,70 @@ table-functions: ref: table-functions.yamsql:42 explain: EXPLODE array((@c5 AS B, @c7 AS C, (@c10 AS X, promote(@c12 AS DOUBLE) AS Y, @c14 AS Z) AS W), (@c19 AS B, @c21 AS C, (@c24 AS X, @c26 AS Y, @c28 - AS Z) AS W)) - task_count: 108 - task_total_time_ms: 0 - transform_count: 29 + AS Z) AS W)) | MAP (_._0.B AS B, _._0.C AS C, _._0.W AS W) + task_count: 137 + task_total_time_ms: 2 + transform_count: 32 transform_time_ms: 0 - transform_yield_count: 6 + transform_yield_count: 8 insert_time_ms: 0 - insert_new_count: 8 + insert_new_count: 13 insert_reused_count: 0 - query: EXPLAIN select B, C, W from values (1, 2.0, (3, 4, 'foo')), (10, 90.2, (5, 6.0, 'bar')) as A(B, C, W(X, Y, Z)) ref: table-functions.yamsql:47 explain: EXPLODE array((@c9 AS B, @c11 AS C, (@c14 AS X, promote(@c16 AS DOUBLE) AS Y, @c18 AS Z) AS W), (@c23 AS B, @c25 AS C, (@c28 AS X, @c30 AS Y, @c32 - AS Z) AS W)) | MAP (_.B AS B, _.C AS C, _.W AS W) - task_count: 114 - task_total_time_ms: 1 - transform_count: 27 + AS Z) AS W)) | MAP (_._0.B AS B, _._0.C AS C, _._0.W AS W) + task_count: 137 + task_total_time_ms: 3 + transform_count: 32 transform_time_ms: 0 - transform_yield_count: 6 + transform_yield_count: 8 insert_time_ms: 0 - insert_new_count: 9 + insert_new_count: 13 insert_reused_count: 0 - query: EXPLAIN select A.B, C, W from values (1, 2.0, (3, 4, 'foo')), (10, 90.2, (5, 6.0, 'bar')) as A(B, C, W(X, Y, Z)) ref: table-functions.yamsql:60 explain: EXPLODE array((@c11 AS B, @c13 AS C, (@c16 AS X, promote(@c18 AS DOUBLE) AS Y, @c20 AS Z) AS W), (@c25 AS B, @c27 AS C, (@c30 AS X, @c32 AS Y, @c34 - AS Z) AS W)) | MAP (_.B AS B, _.C AS C, _.W AS W) - task_count: 114 - task_total_time_ms: 1 - transform_count: 27 + AS Z) AS W)) | MAP (_._0.B AS B, _._0.C AS C, _._0.W AS W) + task_count: 137 + task_total_time_ms: 4 + transform_count: 32 transform_time_ms: 0 - transform_yield_count: 6 + transform_yield_count: 8 insert_time_ms: 0 - insert_new_count: 9 + insert_new_count: 13 insert_reused_count: 0 - query: EXPLAIN select A.B, C as Q, W.X from values (1, 2.0, (3, 4, 'foo')), (10, 90.2, (5, 6.0, 'bar')) as A(B, C, W(X, Y, Z)) ref: table-functions.yamsql:65 explain: EXPLODE array((@c15 AS B, @c17 AS C, (@c20 AS X, promote(@c22 AS DOUBLE) AS Y, @c24 AS Z) AS W), (@c29 AS B, @c31 AS C, (@c34 AS X, @c36 AS Y, @c38 - AS Z) AS W)) | MAP (_.B AS B, _.C AS Q, _.W.X AS X) - task_count: 114 - task_total_time_ms: 1 - transform_count: 27 - transform_time_ms: 0 - transform_yield_count: 6 + AS Z) AS W)) | MAP (_._0.B AS B, _._0.C AS Q, _._0.W.X AS X) + task_count: 137 + task_total_time_ms: 4 + transform_count: 32 + transform_time_ms: 1 + transform_yield_count: 8 insert_time_ms: 0 - insert_new_count: 9 + insert_new_count: 13 insert_reused_count: 0 - query: EXPLAIN select * from (select A.B, C as Q, W.X from values (1, 2.0, (3, 4, 'foo')), (10, 90.2, (5, 6.0, 'bar')) as A(B, C, W(X, Y, Z))) as u ref: table-functions.yamsql:70 explain: EXPLODE array((@c19 AS B, @c21 AS C, (@c24 AS X, promote(@c26 AS DOUBLE) AS Y, @c28 AS Z) AS W), (@c33 AS B, @c35 AS C, (@c38 AS X, @c40 AS Y, @c42 - AS Z) AS W)) | MAP (_.B AS B, _.C AS Q, _.W.X AS X) - task_count: 137 - task_total_time_ms: 1 - transform_count: 32 - transform_time_ms: 0 - transform_yield_count: 8 + AS Z) AS W)) | MAP (_._0.B AS B, _._0.C AS Q, _._0.W.X AS X) + task_count: 160 + task_total_time_ms: 6 + transform_count: 37 + transform_time_ms: 1 + transform_yield_count: 10 insert_time_ms: 0 - insert_new_count: 13 + insert_new_count: 17 insert_reused_count: 0 - query: EXPLAIN select * from (select A.B, C as Q, W.X from values (1, 2.0, (3, 4, 'foo')), (10, 90.2, (5, 6.0, 'bar')) as A(B, C, W(X, Y, Z))) as u where @@ -75,15 +75,15 @@ table-functions: ref: table-functions.yamsql:75 explain: EXPLODE array((@c19 AS B, @c21 AS C, (@c24 AS X, promote(@c26 AS DOUBLE) AS Y, @c28 AS Z) AS W), (@c33 AS B, @c35 AS C, (@c38 AS X, @c40 AS Y, @c42 - AS Z) AS W)) | FILTER _.B LESS_THAN @c67 | MAP (_.B AS B, _.C AS Q, _.W.X - AS X) - task_count: 148 - task_total_time_ms: 3 - transform_count: 34 - transform_time_ms: 1 - transform_yield_count: 8 - insert_time_ms: 0 - insert_new_count: 14 + AS Z) AS W)) | FILTER _._0.B LESS_THAN promote(@c67 AS INT) | MAP (_._0.B + AS B, _._0.C AS Q, _._0.W.X AS X) + task_count: 193 + task_total_time_ms: 12 + transform_count: 45 + transform_time_ms: 4 + transform_yield_count: 13 + insert_time_ms: 1 + insert_new_count: 25 insert_reused_count: 0 - query: EXPLAIN select * from range(0, 11, 5) ref: table-functions.yamsql:97 diff --git a/yaml-tests/src/test/resources/table-functions.yamsql b/yaml-tests/src/test/resources/table-functions.yamsql index a17f878c8fe..1e3f279d691 100644 --- a/yaml-tests/src/test/resources/table-functions.yamsql +++ b/yaml-tests/src/test/resources/table-functions.yamsql @@ -39,12 +39,12 @@ test_block: - result: [{42}] - - query: select * from values (1, 2.0, (3, 4, 'foo')), (10, 90.2, (5, 6.0, 'bar')) as A(B, C, W(X, Y, Z)) - - explain: "EXPLODE array((@c5 AS B, @c7 AS C, (@c10 AS X, promote(@c12 AS DOUBLE) AS Y, @c14 AS Z) AS W), (@c19 AS B, @c21 AS C, (@c24 AS X, @c26 AS Y, @c28 AS Z) AS W))" + - explain: "EXPLODE array((@c5 AS B, @c7 AS C, (@c10 AS X, promote(@c12 AS DOUBLE) AS Y, @c14 AS Z) AS W), (@c19 AS B, @c21 AS C, (@c24 AS X, @c26 AS Y, @c28 AS Z) AS W)) | MAP (_._0.B AS B, _._0.C AS C, _._0.W AS W)" - result: [{B: 1, C: 2.0, W: {X: 3, Y: 4.0, Z: 'foo'}}, {B: 10, C: 90.2, W: {X: 5, Y: 6.0, Z: 'bar'}}] - - query: select B, C, W from values (1, 2.0, (3, 4, 'foo')), (10, 90.2, (5, 6.0, 'bar')) as A(B, C, W(X, Y, Z)) - - explain: "EXPLODE array((@c9 AS B, @c11 AS C, (@c14 AS X, promote(@c16 AS DOUBLE) AS Y, @c18 AS Z) AS W), (@c23 AS B, @c25 AS C, (@c28 AS X, @c30 AS Y, @c32 AS Z) AS W)) | MAP (_.B AS B, _.C AS C, _.W AS W)" + - explain: "EXPLODE array((@c9 AS B, @c11 AS C, (@c14 AS X, promote(@c16 AS DOUBLE) AS Y, @c18 AS Z) AS W), (@c23 AS B, @c25 AS C, (@c28 AS X, @c30 AS Y, @c32 AS Z) AS W)) | MAP (_._0.B AS B, _._0.C AS C, _._0.W AS W)" - result: [{B: 1, C: 2.0, W: {X: 3, Y: 4.0, Z: 'foo'}}, {B: 10, C: 90.2, W: {X: 5, Y: 6.0, Z: 'bar'}}] - @@ -57,22 +57,22 @@ test_block: {B: 11, C: 3.0, W: [{X: 'd', Y: 'e', Z: [10, 20, 30]}]}] - - query: select A.B, C, W from values (1, 2.0, (3, 4, 'foo')), (10, 90.2, (5, 6.0, 'bar')) as A(B, C, W(X, Y, Z)) - - explain: "EXPLODE array((@c11 AS B, @c13 AS C, (@c16 AS X, promote(@c18 AS DOUBLE) AS Y, @c20 AS Z) AS W), (@c25 AS B, @c27 AS C, (@c30 AS X, @c32 AS Y, @c34 AS Z) AS W)) | MAP (_.B AS B, _.C AS C, _.W AS W)" + - explain: "EXPLODE array((@c11 AS B, @c13 AS C, (@c16 AS X, promote(@c18 AS DOUBLE) AS Y, @c20 AS Z) AS W), (@c25 AS B, @c27 AS C, (@c30 AS X, @c32 AS Y, @c34 AS Z) AS W)) | MAP (_._0.B AS B, _._0.C AS C, _._0.W AS W)" - result: [{B: 1, C: 2.0, W: {X: 3, Y: 4.0, Z: 'foo'}}, {B: 10, C: 90.2, W: {X: 5, Y: 6.0, Z: 'bar'}}] - - query: select A.B, C as Q, W.X from values (1, 2.0, (3, 4, 'foo')), (10, 90.2, (5, 6.0, 'bar')) as A(B, C, W(X, Y, Z)) - - explain: "EXPLODE array((@c15 AS B, @c17 AS C, (@c20 AS X, promote(@c22 AS DOUBLE) AS Y, @c24 AS Z) AS W), (@c29 AS B, @c31 AS C, (@c34 AS X, @c36 AS Y, @c38 AS Z) AS W)) | MAP (_.B AS B, _.C AS Q, _.W.X AS X)" + - explain: "EXPLODE array((@c15 AS B, @c17 AS C, (@c20 AS X, promote(@c22 AS DOUBLE) AS Y, @c24 AS Z) AS W), (@c29 AS B, @c31 AS C, (@c34 AS X, @c36 AS Y, @c38 AS Z) AS W)) | MAP (_._0.B AS B, _._0.C AS Q, _._0.W.X AS X)" - result: [{B: 1, Q: 2.0, X: 3}, {B: 10, Q: 90.2, X: 5}] - - query: select * from (select A.B, C as Q, W.X from values (1, 2.0, (3, 4, 'foo')), (10, 90.2, (5, 6.0, 'bar')) as A(B, C, W(X, Y, Z))) as u - - explain: "EXPLODE array((@c19 AS B, @c21 AS C, (@c24 AS X, promote(@c26 AS DOUBLE) AS Y, @c28 AS Z) AS W), (@c33 AS B, @c35 AS C, (@c38 AS X, @c40 AS Y, @c42 AS Z) AS W)) | MAP (_.B AS B, _.C AS Q, _.W.X AS X)" + - explain: "EXPLODE array((@c19 AS B, @c21 AS C, (@c24 AS X, promote(@c26 AS DOUBLE) AS Y, @c28 AS Z) AS W), (@c33 AS B, @c35 AS C, (@c38 AS X, @c40 AS Y, @c42 AS Z) AS W)) | MAP (_._0.B AS B, _._0.C AS Q, _._0.W.X AS X)" - result: [{B: 1, Q: 2.0, X: 3}, {B: 10, Q: 90.2, X: 5}] - - query: select * from (select A.B, C as Q, W.X from values (1, 2.0, (3, 4, 'foo')), (10, 90.2, (5, 6.0, 'bar')) as A(B, C, W(X, Y, Z))) as u where b < 8 - - explain: "EXPLODE array((@c19 AS B, @c21 AS C, (@c24 AS X, promote(@c26 AS DOUBLE) AS Y, @c28 AS Z) AS W), (@c33 AS B, @c35 AS C, (@c38 AS X, @c40 AS Y, @c42 AS Z) AS W)) | FILTER _.B LESS_THAN @c67 | MAP (_.B AS B, _.C AS Q, _.W.X AS X)" + - explain: "EXPLODE array((@c19 AS B, @c21 AS C, (@c24 AS X, promote(@c26 AS DOUBLE) AS Y, @c28 AS Z) AS W), (@c33 AS B, @c35 AS C, (@c38 AS X, @c40 AS Y, @c42 AS Z) AS W)) | FILTER _._0.B LESS_THAN promote(@c67 AS INT) | MAP (_._0.B AS B, _._0.C AS Q, _._0.W.X AS X)" - result: [{B: 1, Q: 2.0, X: 3}] - - query: select * from range(1, 4) diff --git a/yaml-tests/src/test/resources/valid-identifiers.metrics.binpb b/yaml-tests/src/test/resources/valid-identifiers.metrics.binpb index 2e82b0f7dfa..6b1f40beea6 100644 --- a/yaml-tests/src/test/resources/valid-identifiers.metrics.binpb +++ b/yaml-tests/src/test/resources/valid-identifiers.metrics.binpb @@ -1,39 +1,73 @@ × ™ all-tests‹EXPLAIN select t.id from "foo.table$nested.repeated" as t where exists (select * from t."level0.field1" as x where x."level1$field.3" = 20)¸ -�҆Ë …úø(50ϼ@8B@tCOVERING(foo.table$nested.repeated.idx.field.1.3 [EQUALS promote(@c24 AS LONG)] -> [ID: KEY:[2]]) | MAP (_.ID AS ID)£ digraph G { +Œ«äó(Ì ¹ö„(50ÛŸr8C@tCOVERING(foo.table$nested.repeated.idx.field.1.3 [EQUALS promote(@c24 AS LONG)] -> [ID: KEY:[2]]) | MAP (_.ID AS ID)£ digraph G { fontname=courier; rankdir=BT; splines=line; - 1 [ label=<
Value Computation
MAP (q102.ID AS ID)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID)" ]; + 1 [ label=<
Value Computation
MAP (q104.ID AS ID)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID)" ]; 2 [ label=<
Covering Index Scan
comparisons: [EQUALS promote(@c24 AS LONG)]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(ARRAY(LONG AS level2$array.field.1, LONG AS level2$field.2) AS level1$field.1, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.2, LONG AS level1$field.3) AS level0.field1)" ]; 3 [ label=<
Index
foo.table$nested.repeated.idx.field.1.3
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(ARRAY(LONG AS level2$array.field.1, LONG AS level2$field.2) AS level1$field.1, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.2, LONG AS level1$field.3) AS level0.field1)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 2 -> 1 [ label=< q102> label="q102" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q104> label="q104" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; }ì ª all-testsœEXPLAIN select t.id from "foo.table$nested.repeated" as t where exists (select * from t."level0.field1" as x where x."level1$field.2"."level2$field.1" = 91)¼ -�”¡úË Œªë(50ô‡68B@vCOVERING(foo.table$nested.repeated.idx.field.1.2.1 [EQUALS promote(@c26 AS LONG)] -> [ID: KEY:[2]]) | MAP (_.ID AS ID)¥ digraph G { +Œž¤Ð)Ì ó‹¨(50ýˆ8C@vCOVERING(foo.table$nested.repeated.idx.field.1.2.1 [EQUALS promote(@c26 AS LONG)] -> [ID: KEY:[2]]) | MAP (_.ID AS ID)¥ digraph G { fontname=courier; rankdir=BT; splines=line; - 1 [ label=<
Value Computation
MAP (q102.ID AS ID)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID)" ]; + 1 [ label=<
Value Computation
MAP (q104.ID AS ID)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID)" ]; 2 [ label=<
Covering Index Scan
comparisons: [EQUALS promote(@c26 AS LONG)]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(ARRAY(LONG AS level2$array.field.1, LONG AS level2$field.2) AS level1$field.1, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.2, LONG AS level1$field.3) AS level0.field1)" ]; 3 [ label=<
Index
foo.table$nested.repeated.idx.field.1.2.1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(ARRAY(LONG AS level2$array.field.1, LONG AS level2$field.2) AS level1$field.1, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.2, LONG AS level1$field.3) AS level0.field1)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 2 -> 1 [ label=< q102> label="q102" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -}ó + 2 -> 1 [ label=< q104> label="q104" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; +}Ô7 ± - all-tests£EXPLAIN select t.id from "foo.table$nested.repeated" as t where exists (select * from t."level0.field1" as b, b."level1$field.1" where "level2$array.field.1" = 10)¼ -ƒ„½Ì0À ŽŸ­(E0¡°i8^@vCOVERING(foo.table$nested.repeated.idx.field.1.1.1 [EQUALS promote(@c26 AS LONG)] -> [ID: KEY:[2]]) | MAP (_.ID AS ID)¥ digraph G { + all-tests£EXPLAIN select t.id from "foo.table$nested.repeated" as t where exists (select * from t."level0.field1" as b, b."level1$field.1" where "level2$array.field.1" = 10)�6 +曊—$Ô †››(*0΋q8=@îSCAN([IS foo.table$nested.repeated]) | FLATMAP q0 -> { EXPLODE q0.level0.field1 | FLATMAP q1 -> { EXPLODE (q1._0).level1$field.1 | FILTER _._0.level2$array.field.1 EQUALS promote(@c26 AS LONG) AS q2 RETURN ((q1._0).level1$field.1 AS level1$field.1, (q1._0).level1$field.2 AS level1$field.2, (q1._0).level1$field.3 AS level1$field.3, (q2._0).level2$array.field.1 AS level2$array.field.1, (q2._0).level2$field.2 AS level2$field.2) } | DEFAULT NULL | FILTER _ NOT_NULL AS q3 RETURN (q0.ID AS ID) }�2digraph G { fontname=courier; rankdir=BT; splines=line; - 1 [ label=<
Value Computation
MAP (q117.ID AS ID)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID)" ]; - 2 [ label=<
Covering Index Scan
comparisons: [EQUALS promote(@c26 AS LONG)]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(ARRAY(LONG AS level2$array.field.1, LONG AS level2$field.2) AS level1$field.1, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.2, LONG AS level1$field.3) AS level0.field1)" ]; - 3 [ label=<
Index
foo.table$nested.repeated.idx.field.1.1.1
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(ARRAY(LONG AS level2$array.field.1, LONG AS level2$field.2) AS level1$field.1, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.2, LONG AS level1$field.3) AS level0.field1)" ]; + 1 [ label=<
Nested Loop Join
FLATMAP (q2.ID AS ID)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID)" ]; + 2 [ label=<
Scan
comparisons: [IS foo.table$nested.repeated]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(ARRAY(LONG AS level2$array.field.1, LONG AS level2$field.2) AS level1$field.1, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.2, LONG AS level1$field.3) AS level0.field1)" ]; + 3 [ label=<
Primary Storage
record types: [foo__2tableA, foo__1tableC, foo__2table__1nested, foo__2table__1repeated, foo__2table__1nested__2repeated, my__1adjacency__1list, foo__2enum__2type, foo__2tableB, __foo__0tableD, foo__2tableE]
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(ARRAY(LONG AS level2$array.field.1, LONG AS level2$field.2) AS level1$field.1, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.2, LONG AS level1$field.3) AS level0.field1)" ]; + 4 [ label=<
Predicate Filter
WHERE q10 NOT_NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(ARRAY(LONG AS level2$array.field.1, LONG AS level2$field.2) AS level1$field.1, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.2, LONG AS level1$field.3, LONG AS level2$array.field.1, LONG AS level2$field.2)" ]; + 5 [ label=<
Value Computation
FIRST $q10 OR NULL
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(ARRAY(LONG AS level2$array.field.1, LONG AS level2$field.2) AS level1$field.1, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.2, LONG AS level1$field.3, LONG AS level2$array.field.1, LONG AS level2$field.2)" ]; + 6 [ label=<
Nested Loop Join
FLATMAP ((q4._0).level1$field.1 AS level1$field.1, (q4._0).level1$field.2 AS level1$field.2, (q4._0).level1$field.3 AS level1$field.3, (q6._0).level2$array.field.1 AS level2$array.field.1, (q6._0).level2$field.2 AS level2$field.2)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(ARRAY(LONG AS level2$array.field.1, LONG AS level2$field.2) AS level1$field.1, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.2, LONG AS level1$field.3, LONG AS level2$array.field.1, LONG AS level2$field.2)" ]; + 7 [ label=<
Predicate Filter
WHERE q6._0.level2$array.field.1 EQUALS promote(@c26 AS LONG)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS level2$array.field.1, LONG AS level2$field.2 AS _0)" ]; + 8 [ label=<
Value Computation
EXPLODE q2.level0.field1
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(ARRAY(LONG AS level2$array.field.1, LONG AS level2$field.2) AS level1$field.1, LONG AS level2$field.1, LONG AS level2$field.2 AS level1$field.2, LONG AS level1$field.3 AS _0)" ]; + 9 [ label=<
Value Computation
EXPLODE (q4._0).level1$field.1
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS level2$array.field.1, LONG AS level2$field.2 AS _0)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 2 -> 1 [ label=< q117> label="q117" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q2> label="q2" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 5 -> 4 [ label=< q10> label="q10" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 6 -> 5 [ label=< q10> label="q10" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 7 -> 6 [ label=< q6> label="q6" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 8 -> 6 [ label=< q4> label="q4" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 9 -> 7 [ label=< q6> label="q6" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 4 -> 1 [ label=< q10> label="q10" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + { + 8 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + } + { + 4 -> 1 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + } + { + rank=same; + rankDir=LR; + 2 -> 4 [ color="red" style="invis" ]; + } + { + 9 -> 6 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + } + { + 7 -> 6 [ color="blue" style="dotted" arrowhead="none" tailport="nw" headport="s" constraint="false" ]; + } + { + rank=same; + rankDir=LR; + 8 -> 7 [ color="red" style="invis" ]; + } }ß r all-testseEXPLAIN select "level0.field1"."level1$field.1"."level2$field.1" from "foo.table$nested" where id = 1è @@ -73,19 +107,18 @@ r rankDir=LR; 2 -> 4 [ color="red" style="invis" ]; } -}� +}µ ¢ - all-tests”EXPLAIN select "foo.table$repeated".id from "foo.table$repeated" where exists (select 1 from "foo.table$repeated"."field.1$array" r where r = 'foo')ç -Í€Ã�Š Ùº´($0ŽÖ8,@PCOVERING(foo.table$repeated.2 [EQUALS @c19] -> [ID: KEY:[2]]) | MAP (_.ID AS ID)ö -digraph G { + all-tests”EXPLAIN select "foo.table$repeated".id from "foo.table$repeated" where exists (select 1 from "foo.table$repeated"."field.1$array" r where r = 'foo')� +Û«Ñ›� ò§À (&0üða80@cCOVERING(foo.table$repeated.2 [EQUALS promote(@c19 AS STRING)] -> [ID: KEY:[2]]) | MAP (_.ID AS ID)‰ digraph G { fontname=courier; rankdir=BT; splines=line; - 1 [ label=<
Value Computation
MAP (q72.ID AS ID)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID)" ]; - 2 [ label=<
Covering Index Scan
comparisons: [EQUALS @c19]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(LONG) AS field.0$array, ARRAY(STRING) AS field.1$array)" ]; + 1 [ label=<
Value Computation
MAP (q73.ID AS ID)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID)" ]; + 2 [ label=<
Covering Index Scan
comparisons: [EQUALS promote(@c19 AS STRING)]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(LONG) AS field.0$array, ARRAY(STRING) AS field.1$array)" ]; 3 [ label=<
Index
foo.table$repeated.2
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, ARRAY(LONG) AS field.0$array, ARRAY(STRING) AS field.1$array)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; - 2 -> 1 [ label=< q72> label="q72" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; + 2 -> 1 [ label=< q73> label="q73" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; }˜ i all-tests\EXPLAIN select t."field.1$array" from "foo.table$repeated" as t where 3 IN t."field.0$array"ª @@ -410,14 +443,17 @@ D 3 -> 2 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q30> label="q30" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -}µ +}ƒ + ^ - all-testsQEXPLAIN select * from values (1, 2, 3), (4, 5, 6) as "_$$$$"("_$$$", "_$$", "_$")Ò -lßê‹ �² (0åô8@\EXPLODE array((@c5 AS _$$$, @c7 AS _$$, @c9 AS _$), (@c13 AS _$$$, @c15 AS _$$, @c17 AS _$))Ødigraph G { + all-testsQEXPLAIN select * from values (1, 2, 3), (4, 5, 6) as "_$$$$"("_$$$", "_$$", "_$")  +‰å›þ ÍÖ<(0ƨ8 @–EXPLODE array((@c5 AS _$$$, @c7 AS _$$, @c9 AS _$), (@c13 AS _$$$, @c15 AS _$$, @c17 AS _$)) | MAP (_._0._$$$ AS _$$$, _._0._$$ AS _$$, _._0._$ AS _$)êdigraph G { fontname=courier; rankdir=BT; splines=line; - 1 [ label=<
Value Computation
EXPLODE array((@c5 AS _$$$, @c7 AS _$$, @c9 AS _$), (@c13 AS _$$$, @c15 AS _$$, @c17 AS _$))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _$$$, INT AS _$$, INT AS _$)" ]; + 1 [ label=<
Value Computation
MAP (q0._0._$$$ AS _$$$, q0._0._$$ AS _$$, q0._0._$ AS _$)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _$$$, INT AS _$$, INT AS _$)" ]; + 2 [ label=<
Value Computation
EXPLODE array((@c5 AS _$$$, @c7 AS _$$, @c9 AS _$), (@c13 AS _$$$, @c15 AS _$$, @c17 AS _$))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(INT AS _$$$, INT AS _$$, INT AS _$ AS _0)" ]; + 2 -> 1 [ label=< q0> label="q0" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; }š n all-testsaEXPLAIN select struct "x$$" ("foo.tableA.A1", "foo.tableA.A2", "foo.tableA.A3") from "foo.tableA"§ diff --git a/yaml-tests/src/test/resources/valid-identifiers.metrics.yaml b/yaml-tests/src/test/resources/valid-identifiers.metrics.yaml index a53a4601a85..755bfb30a92 100644 --- a/yaml-tests/src/test/resources/valid-identifiers.metrics.yaml +++ b/yaml-tests/src/test/resources/valid-identifiers.metrics.yaml @@ -4,13 +4,13 @@ all-tests: ref: valid-identifiers.yamsql:156 explain: 'COVERING(foo.table$nested.repeated.idx.field.1.3 [EQUALS promote(@c24 AS LONG)] -> [ID: KEY:[2]]) | MAP (_.ID AS ID)' - task_count: 641 - task_total_time_ms: 50 - transform_count: 203 - transform_time_ms: 18 + task_count: 652 + task_total_time_ms: 85 + transform_count: 204 + transform_time_ms: 33 transform_yield_count: 53 insert_time_ms: 1 - insert_new_count: 66 + insert_new_count: 67 insert_reused_count: 1 - query: EXPLAIN select t.id from "foo.table$nested.repeated" as t where exists (select * from t."level0.field1" as x where x."level1$field.2"."level2$field.1" @@ -18,32 +18,37 @@ all-tests: ref: valid-identifiers.yamsql:161 explain: 'COVERING(foo.table$nested.repeated.idx.field.1.2.1 [EQUALS promote(@c26 AS LONG)] -> [ID: KEY:[2]]) | MAP (_.ID AS ID)' - task_count: 641 - task_total_time_ms: 33 - transform_count: 203 - transform_time_ms: 12 + task_count: 652 + task_total_time_ms: 87 + transform_count: 204 + transform_time_ms: 36 transform_yield_count: 53 - insert_time_ms: 0 - insert_new_count: 66 + insert_time_ms: 2 + insert_new_count: 67 insert_reused_count: 1 - query: EXPLAIN select t.id from "foo.table$nested.repeated" as t where exists (select * from t."level0.field1" as b, b."level1$field.1" where "level2$array.field.1" = 10) ref: valid-identifiers.yamsql:166 - explain: 'COVERING(foo.table$nested.repeated.idx.field.1.1.1 [EQUALS promote(@c26 - AS LONG)] -> [ID: KEY:[2]]) | MAP (_.ID AS ID)' - task_count: 899 - task_total_time_ms: 101 - transform_count: 320 - transform_time_ms: 38 - transform_yield_count: 69 + explain: SCAN([IS foo.table$nested.repeated]) | FLATMAP q0 -> { EXPLODE q0.level0.field1 + | FLATMAP q1 -> { EXPLODE (q1._0).level1$field.1 | FILTER _._0.level2$array.field.1 + EQUALS promote(@c26 AS LONG) AS q2 RETURN ((q1._0).level1$field.1 AS level1$field.1, + (q1._0).level1$field.2 AS level1$field.2, (q1._0).level1$field.3 AS level1$field.3, + (q2._0).level2$array.field.1 AS level2$array.field.1, (q2._0).level2$field.2 + AS level2$field.2) } | DEFAULT NULL | FILTER _ NOT_NULL AS q3 RETURN (q0.ID + AS ID) } + task_count: 614 + task_total_time_ms: 75 + transform_count: 212 + transform_time_ms: 29 + transform_yield_count: 42 insert_time_ms: 1 - insert_new_count: 94 - insert_reused_count: 3 + insert_new_count: 61 + insert_reused_count: 1 - query: EXPLAIN select "level0.field1"."level1$field.1"."level2$field.1" from "foo.table$nested" where id = 1 ref: valid-identifiers.yamsql:171 - explain: SCAN([IS foo.table$nested, EQUALS promote(@c11 AS LONG)]) | MAP (_.level0.field1.level1$field.1.level2$field.1 + explain: SCAN([IS foo__2table__1nested, EQUALS promote(@c11 AS LONG)]) | MAP (_.level0.field1.level1$field.1.level2$field.1 AS level2$field.1) task_count: 448 task_total_time_ms: 34 @@ -56,7 +61,7 @@ all-tests: - query: EXPLAIN select "foo.table$repeated".id from "foo.table$repeated" where 'foo' IN "foo.table$repeated"."field.1$array" ref: valid-identifiers.yamsql:178 - explain: SCAN([IS foo.table$repeated]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.field.1$array) + explain: SCAN([IS foo__2table__1repeated]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.field.1$array) | FILTER @c7 EQUALS _ AS q1 RETURN (q0.ID AS ID) } task_count: 345 task_total_time_ms: 17 @@ -69,20 +74,20 @@ all-tests: - query: EXPLAIN select "foo.table$repeated".id from "foo.table$repeated" where exists (select 1 from "foo.table$repeated"."field.1$array" r where r = 'foo') ref: valid-identifiers.yamsql:183 - explain: 'COVERING(foo.table$repeated.2 [EQUALS @c19] -> [ID: KEY:[2]]) | MAP - (_.ID AS ID)' - task_count: 461 - task_total_time_ms: 31 - transform_count: 138 - transform_time_ms: 9 - transform_yield_count: 36 - insert_time_ms: 0 - insert_new_count: 44 + explain: 'COVERING(foo.table$repeated.2 [EQUALS promote(@c19 AS STRING)] -> [ID: + KEY:[2]]) | MAP (_.ID AS ID)' + task_count: 475 + task_total_time_ms: 46 + transform_count: 143 + transform_time_ms: 19 + transform_yield_count: 38 + insert_time_ms: 1 + insert_new_count: 48 insert_reused_count: 0 - query: EXPLAIN select t."field.1$array" from "foo.table$repeated" as t where 3 IN t."field.0$array" ref: valid-identifiers.yamsql:190 - explain: SCAN([IS foo.table$repeated]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.field.0$array) + explain: SCAN([IS foo__2table__1repeated]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.field.0$array) | FILTER promote(@c9 AS LONG) EQUALS _ AS q1 RETURN (q0.field.1$array AS field.1$array) } task_count: 345 @@ -155,7 +160,7 @@ all-tests: - query: EXPLAIN select * from "foo.tableA", "foo.tableB" where "foo.tableA"."foo.tableA.A1" = "foo.tableB"."foo.tableB.B1"; ref: valid-identifiers.yamsql:286 - explain: SCAN([IS foo.tableB]) | FLATMAP q0 -> { ISCAN(foo.tableA.idx [EQUALS + explain: SCAN([IS foo__2tableB]) | FLATMAP q0 -> { ISCAN(foo.tableA.idx [EQUALS q0.foo.tableB.B1]) AS q1 RETURN (q1.foo.tableA.A1 AS foo.tableA.A1, q1.foo.tableA.A2 AS foo.tableA.A2, q1.foo.tableA.A3 AS foo.tableA.A3, q0.foo.tableB.B1 AS foo.tableB.B1, q0.foo.tableB.B2 AS foo.tableB.B2, q0.foo.tableB.B3 AS foo.tableB.B3) } @@ -246,7 +251,7 @@ all-tests: - query: EXPLAIN select "βήτα__f"("f__e"."foo.tableE.E3") AS "___h.1" from "foo.tableE" as "f__e" where "alpha__f"("f__e"."foo.tableE.E3") = 5 ref: valid-identifiers.yamsql:346 - explain: SCAN([IS foo.tableE]) | FILTER _.foo.tableE.E3.S1 EQUALS promote(@c21 + explain: SCAN([IS foo__2tableE]) | FILTER _.foo.tableE.E3.S1 EQUALS promote(@c21 AS LONG) | MAP (_.foo.tableE.E3.S2 AS ___h.1) task_count: 204 task_total_time_ms: 11 @@ -259,7 +264,7 @@ all-tests: - query: EXPLAIN select "alpha__f"("f__e"."foo.tableE.E3") AS "___h.1" from "foo.tableE" as "f__e" where "βήτα__f"("f__e"."foo.tableE.E3") >= 50 ref: valid-identifiers.yamsql:350 - explain: SCAN([IS foo.tableE]) | FILTER _.foo.tableE.E3.S2 GREATER_THAN_OR_EQUALS + explain: SCAN([IS foo__2tableE]) | FILTER _.foo.tableE.E3.S2 GREATER_THAN_OR_EQUALS promote(@c22 AS LONG) | MAP (_.foo.tableE.E3.S1 AS ___h.1) task_count: 204 task_total_time_ms: 10 @@ -271,8 +276,8 @@ all-tests: insert_reused_count: 2 - query: EXPLAIN select * from "__$func3"(10, 1, 1); ref: valid-identifiers.yamsql:356 - explain: SCAN([IS my$adjacency$list, EQUALS promote(@c7 AS LONG)]) | FLATMAP - q0 -> { SCAN([IS my$adjacency$list, [LESS_THAN promote(@c5 AS LONG)]]) + explain: SCAN([IS my__1adjacency__1list, EQUALS promote(@c7 AS LONG)]) | FLATMAP + q0 -> { SCAN([IS my__1adjacency__1list, [LESS_THAN promote(@c5 AS LONG)]]) | FILTER _.my__parent EQUALS promote(@c7 AS LONG) AS q1 RETURN (q1.me AS _0, q1.my__parent AS _1, q0.me AS _2, q0.my__parent AS _3) } task_count: 1337 @@ -285,7 +290,7 @@ all-tests: insert_reused_count: 17 - query: EXPLAIN select * from "$yay"(5); ref: valid-identifiers.yamsql:360 - explain: SCAN([IS foo.tableE]) | FILTER _.foo.tableE.E3.S1 EQUALS promote(@c5 + explain: SCAN([IS foo__2tableE]) | FILTER _.foo.tableE.E3.S1 EQUALS promote(@c5 AS LONG) | MAP (_.foo.tableE.E1 AS _$x.id) task_count: 338 task_total_time_ms: 28 @@ -297,7 +302,7 @@ all-tests: insert_reused_count: 2 - query: EXPLAIN select * from "__2yay"(6); ref: valid-identifiers.yamsql:364 - explain: SCAN([IS foo.tableE]) | FILTER _.foo.tableE.E3.S1 EQUALS promote(@c5 + explain: SCAN([IS foo__2tableE]) | FILTER _.foo.tableE.E3.S1 EQUALS promote(@c5 AS LONG) | MAP (_.foo.tableE.E1 AS _$y.id) task_count: 338 task_total_time_ms: 12 @@ -309,7 +314,7 @@ all-tests: insert_reused_count: 2 - query: EXPLAIN select * from "नमसà¥�त"(4); ref: valid-identifiers.yamsql:368 - explain: SCAN([IS foo.tableE]) | FILTER _.foo.tableE.E3.S1 EQUALS promote(@c5 + explain: SCAN([IS foo__2tableE]) | FILTER _.foo.tableE.E3.S1 EQUALS promote(@c5 AS LONG) | MAP (_.foo.tableE.E1 AS _$z.id) task_count: 338 task_total_time_ms: 24 @@ -321,7 +326,7 @@ all-tests: insert_reused_count: 2 - query: EXPLAIN select * from "$yay__view"; ref: valid-identifiers.yamsql:374 - explain: SCAN([IS foo.tableE]) | FILTER _.foo.tableE.E3.S1 EQUALS 4 | MAP (_.foo.tableE.E1 + explain: SCAN([IS foo__2tableE]) | FILTER _.foo.tableE.E3.S1 EQUALS 4 | MAP (_.foo.tableE.E1 AS _$x.id) task_count: 294 task_total_time_ms: 14 @@ -333,7 +338,7 @@ all-tests: insert_reused_count: 2 - query: EXPLAIN select * from "__2yay__view"; ref: valid-identifiers.yamsql:378 - explain: SCAN([IS foo.tableE]) | FILTER _.foo.tableE.E3.S1 EQUALS 5 | MAP (_.foo.tableE.E1 + explain: SCAN([IS foo__2tableE]) | FILTER _.foo.tableE.E3.S1 EQUALS 5 | MAP (_.foo.tableE.E1 AS _$y.id) task_count: 294 task_total_time_ms: 14 @@ -345,7 +350,7 @@ all-tests: insert_reused_count: 2 - query: EXPLAIN select * from "வணகà¯�கமà¯�"; ref: valid-identifiers.yamsql:382 - explain: SCAN([IS foo.tableE]) | FILTER _.foo.tableE.E3.S1 EQUALS 6 | MAP (_.foo.tableE.E1 + explain: SCAN([IS foo__2tableE]) | FILTER _.foo.tableE.E3.S1 EQUALS 6 | MAP (_.foo.tableE.E1 AS _$z.id) task_count: 294 task_total_time_ms: 15 @@ -359,21 +364,22 @@ all-tests: "_$") ref: valid-identifiers.yamsql:387 explain: EXPLODE array((@c5 AS _$$$, @c7 AS _$$, @c9 AS _$), (@c13 AS _$$$, @c15 - AS _$$, @c17 AS _$)) - task_count: 108 - task_total_time_ms: 2 - transform_count: 29 + AS _$$, @c17 AS _$)) | MAP (_._0._$$$ AS _$$$, _._0._$$ AS _$$, _._0._$ AS + _$) + task_count: 137 + task_total_time_ms: 6 + transform_count: 32 transform_time_ms: 0 - transform_yield_count: 6 + transform_yield_count: 8 insert_time_ms: 0 - insert_new_count: 8 + insert_new_count: 13 insert_reused_count: 0 - query: EXPLAIN select struct "x$$" ("foo.tableA.A1", "foo.tableA.A2", "foo.tableA.A3") from "foo.tableA" ref: valid-identifiers.yamsql:392 - explain: SCAN([IS foo.tableA]) | MAP (_ AS _0) - task_count: 499 - task_total_time_ms: 50 + explain: SCAN([IS foo__2tableA]) | MAP (_ AS _0) + task_count: 497 + task_total_time_ms: 46 transform_count: 136 transform_time_ms: 10 transform_yield_count: 50 @@ -493,9 +499,9 @@ update-delete-statements: ref: valid-identifiers.yamsql:510 explain: 'COVERING(foo.tableA.idx [EQUALS promote(@c9 AS LONG)] -> [foo__2tableA__2A1: KEY:[0], foo__2tableA__2A2: KEY:[1], foo__2tableA__2A3: KEY:[2]]) | DISTINCT - BY PK | FETCH | UPDATE foo.tableA' - task_count: 709 - task_total_time_ms: 19 + BY PK | FETCH | UPDATE foo__2tableA' + task_count: 707 + task_total_time_ms: 16 transform_count: 141 transform_time_ms: 6 transform_yield_count: 57 @@ -507,9 +513,9 @@ update-delete-statements: ref: valid-identifiers.yamsql:514 explain: 'COVERING(foo.tableA.idx [[GREATER_THAN promote(@c9 AS LONG)]] -> [foo__2tableA__2A1: KEY:[0], foo__2tableA__2A2: KEY:[1], foo__2tableA__2A3: KEY:[2]]) | DISTINCT - BY PK | FETCH | UPDATE foo.tableA | MAP (_.new.foo.tableA.A1 AS foo.tableA.A1)' - task_count: 766 - task_total_time_ms: 17 + BY PK | FETCH | UPDATE foo__2tableA | MAP (_.new.foo.tableA.A1 AS foo.tableA.A1)' + task_count: 762 + task_total_time_ms: 10 transform_count: 155 transform_time_ms: 4 transform_yield_count: 57 diff --git a/yaml-tests/src/test/resources/valid-identifiers.yamsql b/yaml-tests/src/test/resources/valid-identifiers.yamsql index ff67c65073c..cee9bbb004d 100644 --- a/yaml-tests/src/test/resources/valid-identifiers.yamsql +++ b/yaml-tests/src/test/resources/valid-identifiers.yamsql @@ -163,7 +163,7 @@ test_block: - # select from deeply nested repeated table - query: select t.id from "foo.table$nested.repeated" as t where exists (select * from t."level0.field1" as b, b."level1$field.1" where "level2$array.field.1" = 10) - - explain: "COVERING(foo.table$nested.repeated.idx.field.1.1.1 [EQUALS promote(@c26 AS LONG)] -> [ID: KEY:[2]]) | MAP (_.ID AS ID)" + - explain: "SCAN([IS foo.table$nested.repeated]) | FLATMAP q0 -> { EXPLODE q0.level0.field1 | FLATMAP q1 -> { EXPLODE (q1._0).level1$field.1 | FILTER _._0.level2$array.field.1 EQUALS promote(@c26 AS LONG) AS q2 RETURN ((q1._0).level1$field.1 AS level1$field.1, (q1._0).level1$field.2 AS level1$field.2, (q1._0).level1$field.3 AS level1$field.3, (q2._0).level2$array.field.1 AS level2$array.field.1, (q2._0).level2$field.2 AS level2$field.2) } | DEFAULT NULL | FILTER _ NOT_NULL AS q3 RETURN (q0.ID AS ID) }" - result: [{1}] - # select from nested table @@ -175,19 +175,19 @@ test_block: - query: select "foo.table$repeated".id from "foo.table$repeated" where 'foo' IN "foo.table$repeated"."field.1$array" # Ideally, this would use the index "foo.table$repeated.2". It appears to be a matching problem unrelated to the identifier choices # See: https://github.com/FoundationDB/fdb-record-layer/issues/3777 - - explain: "SCAN([IS foo.table$repeated]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.field.1$array) | FILTER @c7 EQUALS _ AS q1 RETURN (q0.ID AS ID) }" + - explain: "SCAN([IS foo.table$repeated]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.field.1$array) | FILTER @c7 EQUALS _._0 AS q1 RETURN (q0.ID AS ID) }" - result: [{1}, {2}] - # select with predicates on repeated scalar fields - query: select "foo.table$repeated".id from "foo.table$repeated" where exists (select 1 from "foo.table$repeated"."field.1$array" r where r = 'foo') - - explain: "COVERING(foo.table$repeated.2 [EQUALS @c19] -> [ID: KEY:[2]]) | MAP (_.ID AS ID)" + - explain: "COVERING(foo.table$repeated.2 [EQUALS promote(@c19 AS STRING)] -> [ID: KEY:[2]]) | MAP (_.ID AS ID)" - result: [{1}, {2}] - # select repeated scalar fields - query: select t."field.1$array" from "foo.table$repeated" as t where 3 IN t."field.0$array" # Ideally, this would use the index "foo.table$repeated.1". It appears to be a matching problem unrelated to the identifier choices # See: https://github.com/FoundationDB/fdb-record-layer/issues/3777 - - explain: "SCAN([IS foo.table$repeated]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.field.0$array) | FILTER promote(@c9 AS LONG) EQUALS _ AS q1 RETURN (q0.field.1$array AS field.1$array) }" + - explain: "SCAN([IS foo.table$repeated]) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.field.0$array) | FILTER promote(@c9 AS LONG) EQUALS _._0 AS q1 RETURN (q0.field.1$array AS field.1$array) }" - result: [{["foo", "bar", "baz"]}] - # select repeated scalar fields @@ -384,7 +384,7 @@ test_block: - # inline table definition - query: select * from values (1, 2, 3), (4, 5, 6) as "_$$$$"("_$$$", "_$$", "_$") - - explain: "EXPLODE array((@c5 AS _$$$, @c7 AS _$$, @c9 AS _$), (@c13 AS _$$$, @c15 AS _$$, @c17 AS _$))" + - explain: "EXPLODE array((@c5 AS _$$$, @c7 AS _$$, @c9 AS _$), (@c13 AS _$$$, @c15 AS _$$, @c17 AS _$)) | MAP (_._0._$$$ AS _$$$, _._0._$$ AS _$$, _._0._$ AS _$)" - result: [{"_$$$": 1, "_$$": 2, "_$": 3}, { "_$$$": 4, "_$$": 5, "_$": 6}] - # named record construction diff --git a/yaml-tests/src/test/resources/versions-tests.metrics.binpb b/yaml-tests/src/test/resources/versions-tests.metrics.binpb index 0e9d57aaced..dc368f82222 100644 --- a/yaml-tests/src/test/resources/versions-tests.metrics.binpb +++ b/yaml-tests/src/test/resources/versions-tests.metrics.binpb @@ -447,10 +447,10 @@ x 3 [ label=<
Index
T4_COL4_VERSION
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS COL1, LONG AS COL2, LONG AS COL3, ARRAY(LONG) AS COL4, VERSION AS __ROW_VERSION)" ]; 3 -> 2 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 2 -> 1 [ label=< q2> label="q2" color="gray20" style="bold" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; -}– +}™ W -versions-queriesCEXPLAIN select "__ROW_VERSION", id, col1 from t4 where 3 in t4.col4º -†§ÐñÀ ¥êË (40û…R8M@»ISCAN(T4_COL2 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.COL4) | FILTER promote(@c9 AS LONG) EQUALS _ AS q1 RETURN (q0.__ROW_VERSION AS __ROW_VERSION, q0.ID AS ID, q0.COL1 AS COL1) }Ýdigraph G { +versions-queriesCEXPLAIN select "__ROW_VERSION", id, col1 from t4 where 3 in t4.col4½ +†§ÐñÀ ¥êË (40û…R8M@¾ISCAN(T4_COL2 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.COL4) | FILTER promote(@c9 AS LONG) EQUALS _._0 AS q1 RETURN (q0.__ROW_VERSION AS __ROW_VERSION, q0.ID AS ID, q0.COL1 AS COL1) }Ýdigraph G { fontname=courier; rankdir=BT; splines=line; @@ -687,17 +687,17 @@ y rankDir=LR; 2 -> 6 [ color="red" style="invis" ]; } -}¢ +}® b -versions-queriesNEXPLAIN select "__ROW_VERSION", id, col1, col3 from t4 where col3 in (1, 3, 5)» +versions-queriesNEXPLAIN select "__ROW_VERSION", id, col1, col3 from t4 where col3 in (1, 3, 5)Ç õ -ÜšÔGŠ £Ç‹(h0½âÊ8»@ÊEXPLODE arrayDistinct(promote(@c13 AS ARRAY(LONG))) | FLATMAP q0 -> { ISCAN(T4_COL3_VERSION [EQUALS q0]) AS q1 RETURN (q1.__ROW_VERSION AS __ROW_VERSION, q1.ID AS ID, q1.COL1 AS COL1, q1.COL3 AS COL3) }Ídigraph G { +óÖþaŠ £±Ý(h0Ô›š8¾@ÍEXPLODE arrayDistinct(promote(@c13 AS ARRAY(LONG))) | FLATMAP q0 -> { ISCAN(T4_COL3_VERSION [EQUALS q0._0]) AS q1 RETURN (q1.__ROW_VERSION AS __ROW_VERSION, q1.ID AS ID, q1.COL1 AS COL1, q1.COL3 AS COL3) }Ödigraph G { fontname=courier; rankdir=BT; splines=line; 1 [ label=<
Nested Loop Join
FLATMAP (q2.__ROW_VERSION AS __ROW_VERSION, q2.ID AS ID, q2.COL1 AS COL1, q2.COL3 AS COL3)
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(VERSION AS __ROW_VERSION, LONG AS ID, STRING AS COL1, LONG AS COL3)" ]; - 2 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(@c13 AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG)" ]; - 3 [ label=<
Index Scan
comparisons: [EQUALS q84]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS COL1, LONG AS COL2, LONG AS COL3, ARRAY(LONG) AS COL4, VERSION AS __ROW_VERSION)" ]; + 2 [ label=<
Value Computation
EXPLODE arrayDistinct(promote(@c13 AS ARRAY(LONG)))
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS _0)" ]; + 3 [ label=<
Index Scan
comparisons: [EQUALS q84._0]
> color="black" shape="plain" style="solid" fillcolor="black" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS COL1, LONG AS COL2, LONG AS COL3, ARRAY(LONG) AS COL4, VERSION AS __ROW_VERSION)" ]; 4 [ label=<
Index
T4_COL3_VERSION
> color="black" shape="plain" style="filled" fillcolor="lightblue" fontname="courier" fontsize="8" tooltip="RELATION(LONG AS ID, STRING AS COL1, LONG AS COL2, LONG AS COL3, ARRAY(LONG) AS COL4, VERSION AS __ROW_VERSION)" ]; 2 -> 1 [ label=< q84> label="q84" color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; 4 -> 3 [ color="gray20" style="solid" fontname="courier" fontsize="8" arrowhead="normal" arrowtail="none" dir="both" ]; @@ -710,10 +710,10 @@ b rankDir=LR; 2 -> 3 [ color="red" style="invis" ]; } -}Œ +}� p -versions-queries\EXPLAIN select "__ROW_VERSION", id, col1, col3 from t4 where col3 in (1, 3, 5) order by col3— -«ÛÅé+� ‚­¼(F0�°K8U@Â[IN arrayDistinct(promote(@c13 AS ARRAY(LONG))) SORTED] | INJOIN q0 -> { ISCAN(T4_COL3_VERSION [EQUALS q0]) | MAP (_.__ROW_VERSION AS __ROW_VERSION, _.ID AS ID, _.COL1 AS COL1, _.COL3 AS COL3) }³digraph G { +versions-queries\EXPLAIN select "__ROW_VERSION", id, col1, col3 from t4 where col3 in (1, 3, 5) order by col3˜ +«‰íùm� ÉÏÑ0(F0ÕðÖ8X@Â[IN arrayDistinct(promote(@c13 AS ARRAY(LONG))) SORTED] | INJOIN q0 -> { ISCAN(T4_COL3_VERSION [EQUALS q0]) | MAP (_.__ROW_VERSION AS __ROW_VERSION, _.ID AS ID, _.COL1 AS COL1, _.COL3 AS COL3) }³digraph G { fontname=courier; rankdir=BT; splines=line; @@ -731,10 +731,10 @@ p rankDir=LR; 5 -> 2 [ color="red" style="invis" ]; } -}á +}â Š -versions-queriesvEXPLAIN select "__ROW_VERSION", id, col1, col3 from t4 where col3 in (1, 3, 5) order by col3 asc, "__ROW_VERSION" descÑ -ݱ¿£ » ‡šŒ(50óÊ 8"@Ê[IN arrayDistinct(promote(@c13 AS ARRAY(LONG))) SORTED] | INJOIN q0 -> { ISCAN(T4_COL3_VERSION [EQUALS q0] REVERSE) | MAP (_.__ROW_VERSION AS __ROW_VERSION, _.ID AS ID, _.COL1 AS COL1, _.COL3 AS COL3) }ådigraph G { +versions-queriesvEXPLAIN select "__ROW_VERSION", id, col1, col3 from t4 where col3 in (1, 3, 5) order by col3 asc, "__ROW_VERSION" descÒ +Ýó¸¬?» ö¼Ü"(50Áåþ8$@Ê[IN arrayDistinct(promote(@c13 AS ARRAY(LONG))) SORTED] | INJOIN q0 -> { ISCAN(T4_COL3_VERSION [EQUALS q0] REVERSE) | MAP (_.__ROW_VERSION AS __ROW_VERSION, _.ID AS ID, _.COL1 AS COL1, _.COL3 AS COL3) }ådigraph G { fontname=courier; rankdir=BT; splines=line; diff --git a/yaml-tests/src/test/resources/versions-tests.metrics.yaml b/yaml-tests/src/test/resources/versions-tests.metrics.yaml index 9e6065d6443..0acfd36cecb 100644 --- a/yaml-tests/src/test/resources/versions-tests.metrics.yaml +++ b/yaml-tests/src/test/resources/versions-tests.metrics.yaml @@ -459,8 +459,8 @@ versions-queries: - query: EXPLAIN select "__ROW_VERSION", id, col1 from t4 where 3 in t4.col4 ref: versions-tests.yamsql:474 explain: ISCAN(T4_COL2 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.COL4) | - FILTER promote(@c9 AS LONG) EQUALS _ AS q1 RETURN (q0.__ROW_VERSION AS __ROW_VERSION, - q0.ID AS ID, q0.COL1 AS COL1) } + FILTER promote(@c9 AS LONG) EQUALS _._0 AS q1 RETURN (q0.__ROW_VERSION AS + __ROW_VERSION, q0.ID AS ID, q0.COL1 AS COL1) } task_count: 646 task_total_time_ms: 66 transform_count: 192 @@ -609,15 +609,15 @@ versions-queries: 3, 5) ref: versions-tests.yamsql:633 explain: EXPLODE arrayDistinct(promote(@c13 AS ARRAY(LONG))) | FLATMAP q0 -> { - ISCAN(T4_COL3_VERSION [EQUALS q0]) AS q1 RETURN (q1.__ROW_VERSION AS __ROW_VERSION, + ISCAN(T4_COL3_VERSION [EQUALS q0._0]) AS q1 RETURN (q1.__ROW_VERSION AS __ROW_VERSION, q1.ID AS ID, q1.COL1 AS COL1, q1.COL3 AS COL3) } task_count: 1397 - task_total_time_ms: 150 + task_total_time_ms: 205 transform_count: 394 - transform_time_ms: 40 + transform_time_ms: 58 transform_yield_count: 104 - insert_time_ms: 3 - insert_new_count: 187 + insert_time_ms: 4 + insert_new_count: 190 insert_reused_count: 8 - query: EXPLAIN select "__ROW_VERSION", id, col1, col3 from t4 where col3 in (1, 3, 5) order by col3 @@ -626,12 +626,12 @@ versions-queries: -> { ISCAN(T4_COL3_VERSION [EQUALS q0]) | MAP (_.__ROW_VERSION AS __ROW_VERSION, _.ID AS ID, _.COL1 AS COL1, _.COL3 AS COL3) }' task_count: 811 - task_total_time_ms: 91 + task_total_time_ms: 230 transform_count: 257 - transform_time_ms: 32 + transform_time_ms: 102 transform_yield_count: 70 - insert_time_ms: 1 - insert_new_count: 85 + insert_time_ms: 5 + insert_new_count: 88 insert_reused_count: 1 - query: EXPLAIN select "__ROW_VERSION", id, col1, col3 from t4 where col3 in (1, 3, 5) order by col3 asc, "__ROW_VERSION" desc @@ -640,12 +640,12 @@ versions-queries: -> { ISCAN(T4_COL3_VERSION [EQUALS q0] REVERSE) | MAP (_.__ROW_VERSION AS __ROW_VERSION, _.ID AS ID, _.COL1 AS COL1, _.COL3 AS COL3) }' task_count: 477 - task_total_time_ms: 67 + task_total_time_ms: 132 transform_count: 187 - transform_time_ms: 33 + transform_time_ms: 72 transform_yield_count: 53 - insert_time_ms: 0 - insert_new_count: 34 + insert_time_ms: 8 + insert_new_count: 36 insert_reused_count: 0 - query: EXPLAIN select (t2.*), (t3.*) from t2, t3 where t2.col2 = 'b' and t3.col1 = 'b' diff --git a/yaml-tests/src/test/resources/versions-tests.yamsql b/yaml-tests/src/test/resources/versions-tests.yamsql index 18fd6a4010f..60c8de61312 100644 --- a/yaml-tests/src/test/resources/versions-tests.yamsql +++ b/yaml-tests/src/test/resources/versions-tests.yamsql @@ -471,7 +471,7 @@ test_block: - query: select "__ROW_VERSION", id, col1 from t4 where 3 in t4.col4 - - explain: "ISCAN(T4_COL2 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.COL4) | FILTER promote(@c9 AS LONG) EQUALS _ AS q1 RETURN (q0.__ROW_VERSION AS __ROW_VERSION, q0.ID AS ID, q0.COL1 AS COL1) }" + - explain: "ISCAN(T4_COL2 <,>) | FLATMAP q0 -> { EXPLODE arrayDistinct(q0.COL4) | FILTER promote(@c9 AS LONG) EQUALS _._0 AS q1 RETURN (q0.__ROW_VERSION AS __ROW_VERSION, q0.ID AS ID, q0.COL1 AS COL1) }" - unorderedResult: [ {__ROW_VERSION: !not_null _, ID: 9, COL1: "a" }, {__ROW_VERSION: !not_null _, ID: 11, COL1: "b" }, @@ -630,7 +630,7 @@ test_block: - query: select "__ROW_VERSION", id, col1, col3 from t4 where col3 in (1, 3, 5) - - explain: "EXPLODE arrayDistinct(promote(@c13 AS ARRAY(LONG))) | FLATMAP q0 -> { ISCAN(T4_COL3_VERSION [EQUALS q0]) AS q1 RETURN (q1.__ROW_VERSION AS __ROW_VERSION, q1.ID AS ID, q1.COL1 AS COL1, q1.COL3 AS COL3) }" + - explain: "EXPLODE arrayDistinct(promote(@c13 AS ARRAY(LONG))) | FLATMAP q0 -> { ISCAN(T4_COL3_VERSION [EQUALS q0._0]) AS q1 RETURN (q1.__ROW_VERSION AS __ROW_VERSION, q1.ID AS ID, q1.COL1 AS COL1, q1.COL3 AS COL3) }" - result: [ {__ROW_VERSION: !not_null _, ID: 19, COL1: "b", COL3: 1 }, {__ROW_VERSION: !not_null _, ID: 20, COL1: "b", COL3: 1 },